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
def get_comment_user(self, obj): return UserProfile.get_user(self.user)
def create_profile(sender, **kw): user = kw["instance"] if kw["created"]: up = UserProfile(user=user) up.save()
def get_user(self): return UserProfile.get_user(self.user)