Mercurial > agora-palash
view apps/profile/forms.py @ 130:5ab229c9d348
Add back ability to edit account settings
* Account/profile editing is now done with a ModelForm, instead of processing
the data manually. Help text and verbose names have been moved to the
Profile model and to the UserForm (in the latter case, it's because we
can't edit the User model directly).
* The profile page now shows pygments style information and sections of the
profile that are not filled are now hidden.
* Some parts of apps/profiles/views.py have been rewritten (the getprofile()
method has been removed, as it's no longer necessary, and the editprofile()
view was rewritten in accordance with the switch to using ModelForms).
* The styling for forms has been modified slightly.
author | dellsystem <ilostwaldo@gmail.com> |
---|---|
date | Sat, 22 Sep 2012 11:18:23 -0400 |
parents | |
children | c7be7def8b57 |
line wrap: on
line source
from django.forms import ModelForm from django.contrib.auth.models import User from django.utils.translation import ugettext as _ from agora.apps.profile.models import Profile class ProfileForm(ModelForm): class Meta: model = Profile exclude = ('user',) class UserForm(ModelForm): class Meta: model = User fields = ('first_name', 'last_name') def __init__(self, *args, **kwargs): super(UserForm, self).__init__(*args, **kwargs) # Change the help text for names name_text = _("We will display your name according to most Western \ European conventions, your given name(s) followed by your surname(s).") self.fields['first_name'].help_text = name_text