Added Agreement properties to Program Model.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- a/app/soc/models/program.py Mon Feb 09 16:17:25 2009 +0000
+++ b/app/soc/models/program.py Tue Feb 10 23:13:06 2009 +0000
@@ -100,6 +100,39 @@
required=True, collection_name="program",
verbose_name=ugettext('Timeline'))
+ #: Whether the slots allocations are visible
+ allocations_visible = db.BooleanProperty(default=False,
+ verbose_name=ugettext('Slot allocations visible'))
+ allocations_visible.help_text = ugettext(
+ 'Field used to indicate if the slot allocations should be visible.')
+
+ #: Document reference property used for the Org Admin Agreement
+ org_admin_agreement = db.ReferenceProperty(
+ reference_class=soc.models.document.Document,
+ verbose_name=ugettext('Organization Admin Agreement'),
+ collection_name='org_admin_agreement')
+ org_admin_agreement.help_text = ugettext(
+ 'Document containing optional Mentor Agreement for participating as a '
+ 'Organization admin.')
+
+ #: Document reference property used for the Mentor Agreement
+ mentor_agreement = db.ReferenceProperty(
+ reference_class=soc.models.document.Document,
+ verbose_name=ugettext('Mentor Agreement'),
+ collection_name='mentor_agreement')
+ mentor_agreement.help_text = ugettext(
+ 'Document containing optional Mentor Agreement for participating as a '
+ 'Mentor.')
+
+ #: Document reference property used for the Student Agreement
+ student_agreement = db.ReferenceProperty(
+ reference_class=soc.models.document.Document,
+ verbose_name=ugettext('Student Agreement'),
+ collection_name='student_agreement')
+ student_agreement.help_text = ugettext(
+ 'Document containing optional Student Agreement for participating as a '
+ 'Student.')
+
#: Status of the program
#: Invisible: Program Stealth-Mode Visible to Hosts and Devs only
#: Visible: Visible to everyone.
@@ -113,9 +146,3 @@
'Visible: Visible to everyone.<br/>'
'Inactive: Not visible in sidebar, not editable.<br/>'
'Invalid: Not visible or editable by anyone.</tt>')
-
- #: Whether the slots allocations are visible
- allocations_visible = db.BooleanProperty(default=False,
- verbose_name=ugettext('Slot allocations visible'))
- allocations_visible.help_text = ugettext(
- 'Field used to indicate if the slot allocations should be visible.')
--- a/app/soc/views/models/program.py Mon Feb 09 16:17:25 2009 +0000
+++ b/app/soc/views/models/program.py Tue Feb 10 23:13:06 2009 +0000
@@ -24,6 +24,7 @@
from django import forms
+from django.utils.translation import ugettext
from soc.logic import dicts
from soc.logic.helper import timeline as timeline_helper
@@ -41,6 +42,7 @@
from soc.views.sitemap import sidebar
import soc.logic.models.program
+import soc.models.work
class View(presence_with_tos.View):
@@ -72,25 +74,37 @@
new_params['name'] = "Program"
new_params['sidebar_grouping'] = 'Programs'
- new_params['extra_dynaexclude'] = ['timeline']
+ new_params['extra_dynaexclude'] = ['timeline', 'org_admin_agreement',
+ 'mentor_agreement', 'student_agreement']
# TODO add clean field to check for uniqueness in link_id and scope_path
new_params['create_extra_dynafields'] = {
'description': forms.fields.CharField(widget=helper.widgets.TinyMCE(
attrs={'rows':10, 'cols':40})),
-
'scope_path': forms.CharField(widget=forms.HiddenInput, required=True),
-
'workflow': forms.ChoiceField(choices=[('gsoc','Project-based'),
('ghop','Task-based')], required=True),
}
new_params['edit_extra_dynafields'] = {
'workflow': forms.CharField(widget=widgets.ReadOnlyInput(),
- required=True),
+ required=True),
+ 'org_admin_agreement_link_id': widgets.ReferenceField(
+ reference_url='document', filter=['scope_path'],
+ required=False, label=ugettext(
+ 'Organization Admin Agreement Document link ID'),
+ help_text=soc.models.work.Work.link_id.help_text),
+ 'mentor_agreement_link_id': widgets.ReferenceField(
+ reference_url='document', filter=['scope_path'],
+ required=False, label=ugettext('Mentor Agreement Document link ID'),
+ help_text=soc.models.work.Work.link_id.help_text),
+ 'student_agreement_link_id': widgets.ReferenceField(
+ reference_url='document', filter=['scope_path'],
+ required=False, label=ugettext('Student Agreement Document link ID'),
+ help_text=soc.models.work.Work.link_id.help_text),
}
- params = dicts.merge(params, new_params)
+ params = dicts.merge(params, new_params, sub_merge=True)
super(View, self).__init__(params=params)