<s> from django . db import models <EOL> from django . contrib . auth . models import User <EOL> class UserProfile ( models . Model ) : <EOL> user = models . OneToOneField ( User , related_name = '<STR_LIT>' ) <EOL> duoshuo_id = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> token = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> avatar = models . TextField ( blank = True , null = True ) <EOL> def __unicode__ ( self ) : <EOL> return self . user . username <EOL> def create_user_profile ( sender = None , instance = None , created = False , ** kwargs ) : <EOL> if created : <EOL> userprofile = UserProfile . objects . create ( user = instance ) <EOL> userprofile . save ( ) <EOL> models . signals . post_save . connect ( create_user_profile , sender = User ) </s>
