# HG changeset patch # User Sverre Rabbelier # Date 1236385990 0 # Node ID 1dbce30b5757e88404b6a95bf8acc3068a60304b # Parent b581fdfd6bb14a80938bb3f6754c3067d55c92be Added a slot allocation view Patch by: Sverre Rabbelier diff -r b581fdfd6bb1 -r 1dbce30b5757 app/soc/templates/soc/program/allocation/heading.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/program/allocation/heading.html Sat Mar 07 00:33:10 2009 +0000 @@ -0,0 +1,5 @@ + + Name + Locked? + Slots + diff -r b581fdfd6bb1 -r 1dbce30b5757 app/soc/templates/soc/program/allocation/row.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/program/allocation/row.html Sat Mar 07 00:33:10 2009 +0000 @@ -0,0 +1,5 @@ + +
{{ list.item.name }}
+ + + diff -r b581fdfd6bb1 -r 1dbce30b5757 app/soc/views/models/program.py --- a/app/soc/views/models/program.py Sat Mar 07 00:32:15 2009 +0000 +++ b/app/soc/views/models/program.py Sat Mar 07 00:33:10 2009 +0000 @@ -31,6 +31,7 @@ from soc.logic.helper import timeline as timeline_helper from soc.logic.models import host as host_logic from soc.logic.models import mentor as mentor_logic +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 program as program_logic from soc.logic.models import student as student_logic @@ -39,6 +40,7 @@ from soc.views import out_of_band from soc.views.helper import access from soc.views.helper import decorators +from soc.views.helper import lists from soc.views.helper import redirects from soc.views.helper import widgets from soc.views.models import presence @@ -84,6 +86,16 @@ new_params['extra_dynaexclude'] = ['timeline', 'org_admin_agreement', 'mentor_agreement', 'student_agreement'] + patterns = [] + patterns += [ + (r'^%(url_name)s/(?Passign_slots)/%(key_fields)s$', + 'soc.views.models.%(module_name)s.assign_slots', + 'Assign slots'), + ] + + new_params['extra_django_patterns'] = patterns + + # TODO add clean field to check for uniqueness in link_id and scope_path new_params['create_extra_dynaproperties'] = { 'description': forms.fields.CharField(widget=helper.widgets.TinyMCE( @@ -134,6 +146,29 @@ super(View, self).__init__(params=params) + @decorators.merge_params + @decorators.check_access + def assignSlots(self, request, access_type, page_name=None, + params=None, **kwargs): + """View that allows to assign slots to orgs. + """ + + from soc.views.models import organization as organization_view + params = organization_view.view.getParams() + params['list_heading'] = 'soc/program/allocation/heading.html' + params['list_row'] = 'soc/program/allocation/row.html' + + program = program_logic.logic.getFromKeyFields(kwargs) + + filter = { + 'scope': program, + } + + content = lists.getListContent(request, params, filter=filter) + contents = [content] + + return self._list(request, params, contents, page_name) + def _editPost(self, request, entity, fields): """See base._editPost(). """ @@ -333,6 +368,7 @@ view = View() admin = decorators.view(view.admin) +assign_slots = decorators.view(view.assignSlots) create = decorators.view(view.create) delete = decorators.view(view.delete) edit = decorators.view(view.edit)