Revision d8f63346 snf-astakos-app/astakos/im/forms.py
b/snf-astakos-app/astakos/im/forms.py | ||
---|---|---|
48 | 48 |
from astakos.im.widgets import DummyWidget, RecaptchaWidget, ApprovalTermsWidget |
49 | 49 |
|
50 | 50 |
# since Django 1.4 use django.core.urlresolvers.reverse_lazy instead |
51 |
from astakos.im.util import reverse_lazy |
|
51 |
from astakos.im.util import reverse_lazy, get_latest_terms
|
|
52 | 52 |
|
53 | 53 |
import logging |
54 | 54 |
import recaptcha.client.captcha as captcha |
... | ... | |
80 | 80 |
kwargs.pop('ip') |
81 | 81 |
super(LocalUserCreationForm, self).__init__(*args, **kwargs) |
82 | 82 |
self.fields.keyOrder = ['email', 'first_name', 'last_name', |
83 |
'password1', 'password2', |
|
84 |
'has_signed_terms'] |
|
83 |
'password1', 'password2'] |
|
84 |
if get_latest_terms(): |
|
85 |
self.fields.keyOrder.append('has_signed_terms') |
|
85 | 86 |
if RECAPTCHA_ENABLED: |
86 | 87 |
self.fields.keyOrder.extend(['recaptcha_challenge_field', |
87 | 88 |
'recaptcha_response_field',]) |
... | ... | |
149 | 150 |
Changes the order of fields, and removes the username field. |
150 | 151 |
""" |
151 | 152 |
super(InvitedLocalUserCreationForm, self).__init__(*args, **kwargs) |
152 |
self.fields.keyOrder = ['email', 'inviter', 'first_name', |
|
153 |
'last_name', 'password1', 'password2', |
|
154 |
'has_signed_terms'] |
|
155 |
if RECAPTCHA_ENABLED: |
|
156 |
self.fields.keyOrder.extend(['recaptcha_challenge_field', |
|
157 |
'recaptcha_response_field',]) |
|
158 | 153 |
|
159 | 154 |
#set readonly form fields |
160 | 155 |
self.fields['inviter'].widget.attrs['readonly'] = True |
Also available in: Unified diff