Esempio n. 1
0
    def save(self, *args, **kwargs):
        user = super(UserForm, self).save(*args, **kwargs)
        profile = UserProfile.objects.filter(user=user)[0]
        if profile is None:
            profile = UserProfile()

        profile.user = user
        profile.avatar_type = self.cleaned_data['avatar_image_select']
        profile.avatar_image = self.cleaned_data['avatar_image']
        # and so on with the remaining fields
        profile.save()
        return profile
Esempio n. 2
0
 def get_comment_user(self, obj):
     return UserProfile.get_user(self.user)
Esempio n. 3
0
def create_profile(sender, **kw):
    user = kw["instance"]
    if kw["created"]:
        up = UserProfile(user=user)
        up.save()
Esempio n. 4
0
 def get_user(self):
     return UserProfile.get_user(self.user)
Esempio n. 5
0
 def get_comment_user(self, obj):
     return UserProfile.get_user(self.user)
Esempio n. 6
0
def create_profile(sender, **kw):
    user = kw["instance"]
    if kw["created"]:
        up = UserProfile(user=user)
        up.save()