--- a/app/soc/views/models/mentor.py Sat Feb 21 16:00:17 2009 +0000
+++ b/app/soc/views/models/mentor.py Sat Feb 21 16:00:52 2009 +0000
@@ -30,6 +30,7 @@
from soc.logic.models import organization as org_logic
from soc.views.helper import access
from soc.views.helper import dynaform
+from soc.views.helper import params as params_helper
from soc.views.helper import widgets
from soc.views.models import organization as org_view
from soc.views.models import role
@@ -81,15 +82,26 @@
new_params['extra_dynaexclude'] = ['agreed_to_tos', 'program']
- new_params['create_extra_dynaproperties'] = {
- 'scope_path': forms.fields.CharField(widget=forms.HiddenInput,
- required=True),
- 'mentor_agreement': forms.fields.CharField(required=False,
- widget=widgets.AgreementField),
- 'agreed_to_mentor_agreement': forms.fields.BooleanField(
- initial=False, required=True,
- label=ugettext('I agree to the Mentor Agreement')),
- }
+ new_params['create_dynafields'] = [
+ {'name': 'scope_path',
+ 'base': forms.fields.CharField,
+ 'widget': forms.HiddenInput,
+ 'required': True,
+ },
+ {'name': 'mentor_agreement',
+ 'base': forms.fields.CharField,
+ 'required': False,
+ 'widget': widgets.AgreementField,
+ 'group': ugettext("5. Terms of Service"),
+ },
+ {'name': 'agreed_to_mentor_agreement',
+ 'base': forms.fields.BooleanField,
+ 'initial': False,
+ 'required':True,
+ 'label': ugettext('I agree to the Mentor Agreement'),
+ 'group': ugettext("5. Terms of Service"),
+ },
+ ]
new_params['allow_requests_and_invites'] = True
new_params['show_in_roles_overview'] = True
@@ -102,16 +114,25 @@
params['group_view'].registerRole(params['module_name'], self)
# create and store the special form for invited users
- updated_fields = {
- 'link_id': forms.CharField(widget=widgets.ReadOnlyInput(),
- required=False),
- 'mentor_agreement': forms.fields.Field(required=False,
- widget=widgets.AgreementField),
- }
+ dynafields = [
+ {'name': 'link_id',
+ 'base': forms.CharField,
+ 'widget': widgets.ReadOnlyInput(),
+ 'required': False,
+ },
+ {'name': 'mentor_agreement',
+ 'base': forms.fields.Field,
+ 'required': False,
+ 'widget': widgets.AgreementField,
+ 'group': ugettext("5. Terms of Service"),
+ },
+ ]
+
+ dynaproperties = params_helper.getDynaFields(dynafields)
invited_create_form = dynaform.extendDynaForm(
- dynaform = self._params['create_form'],
- dynaproperties = updated_fields)
+ dynaform=self._params['create_form'],
+ dynaproperties=dynaproperties)
params['invited_create_form'] = invited_create_form