Changeset 5948


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?.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
2 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
  • main/waeup.sirp/trunk/src/waeup/sirp/university/interfaces.py

    r5944 r5948  
    3030    """Representation of a university faculty.
    3131    """
     32    code = schema.TextLine(
     33        title = u'Code',
     34        description = u'Abbreviated code of the faculty',
     35        default = u'NA',
     36        required = True,
     37        readonly = True,
     38        )
     39
    3240    title = schema.TextLine(
    3341        title = u'Name of Faculty',
     
    4250        )
    4351   
    44     code = schema.TextLine(
    45         title = u'Code',
    46         description = u'Abbreviated code of the faculty',
    47         default = u'NA',
    48         required = True,
    49         )
    50 
    5152class IFacultyContainer(IWAeUPContainer):
    5253    """A container for faculties.
     
    6061    """Representation of a department.
    6162    """
     63    code = schema.TextLine(
     64        title = u'Code',
     65        default = u'NA',
     66        description = u'Abbreviated code of the department',
     67        required = True,
     68        readonly = True,
     69        )
     70
    6271    title = schema.TextLine(
    6372        title = u'Name of Department',
     
    6978        title = u'Title prefix',
    7079        default = u'department',
    71         required = True,
    72         )
    73    
    74     code = schema.TextLine(
    75         title = u'Code',
    76         default = u'NA',
    77         description = u'Abbreviated code of the department',
    7880        required = True,
    7981        )
     
    139141        description = u'Abbreviated code of the certificate.',
    140142        required = True,
     143        readonly = True,
    141144        )
    142145
    143146    review_state = schema.Choice(
    144         title = u'review state',
     147        title = u'Review State',
    145148        default = 'unchecked',
    146149        values = ['unchecked', 'checked']
     
    148151
    149152    title = schema.TextLine(
    150         title = u'title',
     153        title = u'Title',
    151154        required = True,
    152155        )
    153156
    154157    study_mode = schema.TextLine(
    155         title = u'study mode',
     158        title = u'Study Mode',
    156159        required = True,
    157160        )
    158161
    159162    start_level = schema.TextLine(
    160         title = u'start level',
     163        title = u'Start Level',
    161164        required = True,
    162165        )
    163166   
    164167    end_level = schema.TextLine(
    165         title = u'end level',
     168        title = u'End Level',
    166169        required = True,
    167170        )
    168171   
    169172    application_category = schema.TextLine(
    170         title = u'application category',
     173        title = u'aApplication Category',
    171174        required = False,
    172         )
    173    
    174     max_pass = schema.TextLine(
    175         title = u'maximum pass',
    176         required = False,
    177         )
    178    
     175        )   
    179176
    180177   
Note: See TracChangeset for help on using the changeset viewer.