<s> import datetime <EOL> from django . contrib . auth . models import User <EOL> from django . db import models <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from libs . utils . abstract_models import BaseFields <EOL> GENDER = ( <EOL> ( <NUM_LIT:0> , _ ( '<STR_LIT>' ) ) , <EOL> ( <NUM_LIT:1> , _ ( '<STR_LIT>' ) ) , <EOL> ) <EOL> class Interest ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> name = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:50> ) <EOL> class UserAddress ( BaseFields ) : <EOL> """<STR_LIT>""" <EOL> country = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , blank = True , <EOL> null = True ) <EOL> city = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , blank = True , null = True ) <EOL> county = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , blank = True , null = True ) <EOL> address_1 = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , blank = True , null = True ) <EOL> address_2 = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , blank = True , null = True ) <EOL> phone_1 = models . IntegerField ( _ ( '<STR_LIT>' ) , null = True , blank = True ) <EOL> phone_2 = models . IntegerField ( _ ( '<STR_LIT>' ) , null = True , blank = True ) <EOL> website = models . URLField ( _ ( '<STR_LIT>' ) , null = True , blank = True ) <EOL> class UserProfile ( BaseFields ) : <EOL> """<STR_LIT>""" <EOL> user = models . OneToOneField ( User , related_name = '<STR_LIT>' ) <EOL> firstname = models . CharField ( _ ( '<STR_LIT:Name>' ) , max_length = <NUM_LIT:50> , blank = True ) <EOL> lastname = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:200> , blank = True ) <EOL> gender = models . PositiveSmallIntegerField ( _ ( '<STR_LIT>' ) , choices = GENDER , <EOL> blank = True ) <EOL> birthdate = models . DateField ( _ ( '<STR_LIT>' ) , blank = True , null = True , <EOL> help_text = '<STR_LIT>' ) <EOL> address = models . ForeignKey ( UserAddress , blank = True , null = True ) <EOL> interests = models . ManyToManyField ( Interest , blank = True , null = True ) <EOL> def get_age ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . birthdate : <EOL> diff = datetime . date . today ( ) - self . birthdate <EOL> years = diff . days / <NUM_LIT> <EOL> return years <EOL> else : <EOL> return '<STR_LIT>' <EOL> class Meta : <EOL> ordering = ( '<STR_LIT>' , ) <EOL> get_latest_by = '<STR_LIT>' <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" . format ( self . firstname , self . lastname ) </s>
