# HG changeset patch # User Sverre Rabbelier # Date 1234624562 0 # Node ID ec79c190f5cae1dce176027399ffee597e3dd5ca # Parent 9b253b8e4d40c33061ff5f609380720c594ba1d3 Force-check the 'agreed to admin agreement' field if applicable If the current user is the applicant of the relevant organization, they already agreed to the agreement once. As such the box should be pre-checked. Patch by: Sverre Rabbelier diff -r 9b253b8e4d40 -r ec79c190f5ca app/soc/views/models/org_admin.py --- a/app/soc/views/models/org_admin.py Sat Feb 14 15:15:38 2009 +0000 +++ b/app/soc/views/models/org_admin.py Sat Feb 14 15:16:02 2009 +0000 @@ -29,6 +29,7 @@ from soc.logic import dicts from soc.logic.models import organization as org_logic from soc.logic.models import org_admin as org_admin_logic +from soc.logic.models import org_app as org_app_logic from soc.views.helper import access from soc.views.helper import dynaform from soc.views.helper import widgets @@ -42,6 +43,9 @@ """View methods for the Organization Admin model. """ + DEF_ALREADY_AGREED_MSG = ugettext( + "You already agreed to the Agreement when applying") + def __init__(self, params=None): """Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. @@ -165,6 +169,14 @@ form.fields['admin_agreement'] = None return + org_app = org_app_logic.logic.getFromKeyName(scope_path) + + if not entity and org_app: + if org_app.applicant.key() == context['user'].key(): + form.fields['agreed_to_admin_agreement'] = forms.fields.BooleanField( + widget=widgets.ReadOnlyInput, initial=True, required=True, + help_text=self.DEF_ALREADY_AGREED_MSG) + entity = org_logic.logic.getFromKeyName(scope_path) if not (entity and entity.scope and entity.scope.org_admin_agreement):