def init(self): try: get_profile = self.instance.get_profile() except : get_profile = ProfileUser(user=self.instance) get_profile.save() self.fields["spam"].initial=get_profile.spam
def init(self): try: get_profile = self.instance.get_profile() except: get_profile = ProfileUser(user=self.instance) get_profile.save() self.fields["spam"].initial = get_profile.spam
def save(self): user = super(FormUserEdit, self).save() try: get_profile = user.get_profile() except : get_profile = ProfileUser(user=user) get_profile.save() get_profile.spam = self.cleaned_data['spam'] get_profile.save() message = EmailMessage("Изменение профиля на Life.interzet.ru",render_to_string("registration/change_profile.html",{"user":user}),settings.DEFAULT_FROM_EMAIL,[user.email]) message.content_subtype = 'html' message.send()
def save(self): user = super(FormUserEdit, self).save() try: get_profile = user.get_profile() except: get_profile = ProfileUser(user=user) get_profile.save() get_profile.spam = self.cleaned_data['spam'] get_profile.save() message = EmailMessage( "Изменение профиля на Life.interzet.ru", render_to_string("registration/change_profile.html", {"user": user}), settings.DEFAULT_FROM_EMAIL, [user.email]) message.content_subtype = 'html' message.send()