equal
deleted
inserted
replaced
27 from django.utils.translation import ugettext |
27 from django.utils.translation import ugettext |
28 |
28 |
29 from soc.logic import dicts |
29 from soc.logic import dicts |
30 from soc.logic.models import organization as org_logic |
30 from soc.logic.models import organization as org_logic |
31 from soc.logic.models import org_admin as org_admin_logic |
31 from soc.logic.models import org_admin as org_admin_logic |
|
32 from soc.logic.models import org_app as org_app_logic |
32 from soc.views.helper import access |
33 from soc.views.helper import access |
33 from soc.views.helper import dynaform |
34 from soc.views.helper import dynaform |
34 from soc.views.helper import widgets |
35 from soc.views.helper import widgets |
35 from soc.views.models import organization as org_view |
36 from soc.views.models import organization as org_view |
36 from soc.views.models import role |
37 from soc.views.models import role |
39 |
40 |
40 |
41 |
41 class View(role.View): |
42 class View(role.View): |
42 """View methods for the Organization Admin model. |
43 """View methods for the Organization Admin model. |
43 """ |
44 """ |
|
45 |
|
46 DEF_ALREADY_AGREED_MSG = ugettext( |
|
47 "You already agreed to the Agreement when applying") |
44 |
48 |
45 def __init__(self, params=None): |
49 def __init__(self, params=None): |
46 """Defines the fields and methods required for the base View class |
50 """Defines the fields and methods required for the base View class |
47 to provide the user with list, public, create, edit and delete views. |
51 to provide the user with list, public, create, edit and delete views. |
48 |
52 |
163 else: |
167 else: |
164 # TODO: is this always sufficient? |
168 # TODO: is this always sufficient? |
165 form.fields['admin_agreement'] = None |
169 form.fields['admin_agreement'] = None |
166 return |
170 return |
167 |
171 |
|
172 org_app = org_app_logic.logic.getFromKeyName(scope_path) |
|
173 |
|
174 if not entity and org_app: |
|
175 if org_app.applicant.key() == context['user'].key(): |
|
176 form.fields['agreed_to_admin_agreement'] = forms.fields.BooleanField( |
|
177 widget=widgets.ReadOnlyInput, initial=True, required=True, |
|
178 help_text=self.DEF_ALREADY_AGREED_MSG) |
|
179 |
168 entity = org_logic.logic.getFromKeyName(scope_path) |
180 entity = org_logic.logic.getFromKeyName(scope_path) |
169 |
181 |
170 if not (entity and entity.scope and entity.scope.org_admin_agreement): |
182 if not (entity and entity.scope and entity.scope.org_admin_agreement): |
171 return |
183 return |
172 |
184 |