Ignore:
Timestamp:
14 Apr 2011, 21:25:35 (14 years ago)
Author:
Henrik Bettermann
Message:

Set all code attributes readonly but ensure that code can be filled in AddFormPages?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r5946 r5948  
    862862    grok.require('waeup.manageUniversity')
    863863    grok.name('add')
    864     form_fields = grok.AutoFields(IFaculty)
    865864    label = ''
    866865    title = 'Add faculty'
    867866    pnav = 1
     867   
     868    # We need a deepcopy here, because otherwise also all other
     869    # IFaculty forms would be affected.
     870    form_fields = copy.deepcopy(grok.AutoFields(IFaculty))
     871    form_fields.get('code').field.readonly = False   
    868872
    869873    @grok.action('Add faculty')
     
    923927    grok.name('add')
    924928    grok.require('waeup.manageUniversity')
    925     form_fields = grok.AutoFields(IDepartment)
    926929    title = 'Add department'
    927930    label = ''
    928931    pnav = 1
     932   
     933    # We need a deepcopy here, because otherwise also all other
     934    # IDepartment forms would be affected.
     935    form_fields = copy.deepcopy(grok.AutoFields(IDepartment))
     936    form_fields.get('code').field.readonly = False
    929937   
    930938    @grok.action('Add department')
     
    954962    grok.name('manage')
    955963    grok.require('waeup.manageUniversity')
     964    title = 'Edit faculty'
     965    pnav = 1
     966
    956967    form_fields = grok.AutoFields(IFaculty)
    957     title = 'Edit faculty'
    958     pnav = 1
    959968
    960969    @grok.action('Save')
     
    10821091    title = u'Add certificate'
    10831092    pnav = 1
    1084     form_fields = grok.AutoFields(ICertificate)
    1085    
     1093   
     1094    # We need a deepcopy here, because otherwise also all other
     1095    # ICertificate forms would be affected.
     1096    form_fields = copy.deepcopy(grok.AutoFields(ICertificate))
     1097    form_fields.get('code').field.readonly = False
     1098       
    10861099    @grok.action('Add certificate')
    10871100    def addCertificate(self, **data):
     
    12201233    grok.name('manage')
    12211234    grok.require('waeup.manageUniversity')
    1222     # We omit 'code' field from original schema and set prepend a new
    1223     # one with 'readonly' set to True.
    1224     form_fields = grok.Fields(
    1225         code = schema.TextLine(
    1226             title = u'Code', readonly=True
    1227             )
    1228         ) + grok.AutoFields(ICertificate).omit('code')
    1229     pnav = 1
     1235    pnav = 1
     1236   
     1237    form_fields = grok.AutoFields(ICertificate)
    12301238
    12311239    @property
Note: See TracChangeset for help on using the changeset viewer.