diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-10-02 20:52:06 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-10-02 20:52:06 -0400 |
commit | dceadbebbe0b196278573ed294be8c631d45ecef (patch) | |
tree | 5274fc4e0397a705dcf1d488074bea9503b3f2c7 /devel/forms.py | |
parent | 724f8c309c97aa9af7f963687342e8f37e682204 (diff) | |
parent | 355087ebe2e3fbd5f860e4655888a89d9df52e34 (diff) |
Merge branch 'master-nomake'
Diffstat (limited to 'devel/forms.py')
-rw-r--r-- | devel/forms.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/devel/forms.py b/devel/forms.py index 7f7c281e..d953c614 100644 --- a/devel/forms.py +++ b/devel/forms.py @@ -1,4 +1,5 @@ import random +from collections import OrderedDict from string import ascii_letters, digits from django import forms @@ -52,13 +53,16 @@ class NewUserForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(NewUserForm, self).__init__(*args, **kwargs) - # Hack ourself so certain fields appear first. self.fields is a - # SortedDict object where we can manipulate the keyOrder list. - order = self.fields.keyOrder - keys = ('username', 'private_email', 'first_name', 'last_name') - for key in reversed(keys): - order.remove(key) - order.insert(0, key) + # Hack ourself so certain fields appear first + old = self.fields + self.fields = OrderedDict() + keys = ('username', 'private_email', 'first_name', 'last_name', + 'alias', 'public_email') + for key in keys: + self.fields[key] = old[key] + for key, val in old.items(): + if key not in keys: + self.fields[key] = old[key] def clean_username(self): username = self.cleaned_data['username'] |