Changeset 4492 for waeup/branches


Ignore:
Timestamp:
31 Jul 2009, 08:05:45 (15 years ago)
Author:
uli
Message:

Make code field of courses writable in add forms.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/university/department.py

    r4491 r4492  
    11"""University departments.
    22"""
     3import copy
    34import grok
    45from zope.component import createObject
     
    133134class AddCourseForm(grok.AddForm):
    134135    grok.context(IDepartment)
    135     form_fields = grok.AutoFields(ICourse)
     136    form_fields = copy.deepcopy(grok.AutoFields(ICourse))
     137    form_fields.get('code').field.readonly = False
    136138    label = 'Add a course'
    137139
     
    148150        self.redirect(self.url(self.context))
    149151
     152    @grok.action('Cancel')
     153    def cancel(self, **data):
     154        self.redirect(self.url(self.context))
     155        return
     156
     157       
    150158class AddCourse(FormWrapMixin, grok.Viewlet):
    151159    """A viewlet that wraps the `AddFacultyForm`.
Note: See TracChangeset for help on using the changeset viewer.