annotate apps/profile/forms.py @ 151:c7be7def8b57

Bundles! (basic functionality) Changes made in this commit: * Added new dependencies (see pip-requirements) * Added new dependency and setup information to README * Deleted the included mptt app (in apps/mptt) in favour of just adding the dependency to pip-requirements (makes it easier to update, etc) * Changed the import convention to use `from apps.bundle.models import Bundle` rather than `from agora.apps.bundle.models import Bundle` because Celery was having problems with the latter style. Everything should still work. * Moved the syntax-highlighting and related code for snippets into separate HTML files so that they can be used by the bundle app And, of course, the ability to upload bundles. But wait! There's more! Changes still to come, for only $19.95 a month: * Bundle versioning * Automatic license integration (i.e. adding headers to files) * The ability to download bundles (zip, tar, etc) * Rating bundles * And much, much more! Batteries not included.
author dellsystem <ilostwaldo@gmail.com>
date Mon, 15 Oct 2012 00:52:00 -0400
parents 5ab229c9d348
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
130
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
1 from django.forms import ModelForm
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
2 from django.contrib.auth.models import User
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
3 from django.utils.translation import ugettext as _
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
4
151
c7be7def8b57 Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents: 130
diff changeset
5 from apps.profile.models import Profile
130
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
6
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
7
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
8 class ProfileForm(ModelForm):
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
9 class Meta:
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
10 model = Profile
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
11 exclude = ('user',)
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
12
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
13
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
14 class UserForm(ModelForm):
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
15 class Meta:
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
16 model = User
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
17 fields = ('first_name', 'last_name')
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
18
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
19 def __init__(self, *args, **kwargs):
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
20 super(UserForm, self).__init__(*args, **kwargs)
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
21
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
22 # Change the help text for names
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
23 name_text = _("We will display your name according to most Western \
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
24 European conventions, your given name(s) followed by your surname(s).")
5ab229c9d348 Add back ability to edit account settings
dellsystem <ilostwaldo@gmail.com>
parents:
diff changeset
25 self.fields['first_name'].help_text = name_text