# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import

from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from annoying.fields import AutoOneToOneField

@python_2_unicode_compatible
class User(AbstractUser):

    # First Name and Last Name do not cover name patterns
    # around the globe.

    # Basic User Information
    name = models.CharField(_("Name of User"), blank=True, max_length=255)
    organization = models.CharField(_("Organization/School"), blank=True, max_length=255)
    education = models.CharField(_("Education"), blank=True, max_length=255)
    url = models.URLField(_("URL"), blank=True)
    phone = models.CharField(_("Phone nubmer"), blank=True, max_length=255)
    address = models.CharField(_("Address"), blank=True, max_length=255)
    language =  models.CharField(_("Language"), blank=True, max_length=255)
    area = models.CharField(_("Area/Nation"), blank=True, max_length=255)
    about = models.CharField(_("About Me"), blank=True, max_length=255)
    social_facebook = models.URLField(_("Social - Facebook"), blank=True, max_length=255)
    social_google = models.URLField(_("Social - Google Plus"), blank=True, max_length=255)
    social_linkedin = models.URLField(_("Social - Linkedin"), blank=True, max_length=255)
    social_twitter = models.URLField(_("Social - Twitter"), blank=True, max_length=255)

    # User Pedagogical Information
    teaching_category = models.CharField(_("Teaching Category"), blank=True, max_length=255)
    teaching_subject_area = models.CharField(_("Teaching Subject Area"), blank=True, max_length=255)
    
    # Preferences
    elo_similarity_threshold = models.FloatField(_("ELOs Similarity Threshold"), default=0)

    def __str__(self):
        return self.username

    def get_absolute_url(self):
        return reverse('users:detail', kwargs={'username': self.username})

@python_2_unicode_compatible
class UserProfile(models.Model):
    from commonrepo.elos.models import ELO
    from commonrepo.groups.models import Group

    user = AutoOneToOneField(User, primary_key=True)
    friends = models.ManyToManyField(User, related_name='friend_with')
    follows = models.ManyToManyField(User, related_name='followed_by')
    follow_elos = models.ManyToManyField(ELO, related_name='followed_by')
    follow_groups = models.ManyToManyField(Group, related_name='followed_by')

    def __str__(self):
        return self.user.username

@@ -367,16 +367,17 @@
 eField%0A%0A
+%0A
 @python_
@@ -647,16 +647,25 @@
 arField(
+%0A        
 _(%22Organ
@@ -681,16 +681,24 @@
 chool%22),
+%0A       
  blank=T
@@ -693,32 +693,40 @@
      blank=True,
+%0A       
  max_length=255)
@@ -1014,17 +1014,16 @@
 nguage =
- 
  models.
@@ -1251,32 +1251,41 @@
 models.URLField(
+%0A        
 _(%22Social - Face
@@ -1348,32 +1348,41 @@
 models.URLField(
+%0A        
 _(%22Social - Goog
@@ -1387,24 +1387,32 @@
 ogle Plus%22),
+%0A       
  blank=True,
@@ -1403,32 +1403,40 @@
      blank=True,
+%0A       
  max_length=255)
@@ -1466,32 +1466,41 @@
 models.URLField(
+%0A        
 _(%22Social - Link
@@ -1572,16 +1572,25 @@
 RLField(
+%0A        
 _(%22Socia
@@ -1701,32 +1701,41 @@
 odels.CharField(
+%0A        
 _(%22Teaching Cate
@@ -1815,16 +1815,25 @@
 arField(
+%0A        
 _(%22Teach
@@ -1880,20 +1880,16 @@
 th=255)%0A
-    
 %0A    # P
@@ -1944,24 +1944,33 @@
 .FloatField(
+%0A        
 _(%22ELOs Simi
@@ -2162,16 +2162,17 @@
 name%7D)%0A%0A
+%0A
 @python_

更新 modules users/models.py, 修正 PEP8 警告