Changeset 6750


Ignore:
Timestamp:
13 Sep 2011, 16:21:44 (13 years ago)
Author:
Henrik Bettermann
Message:

Add matriculation number to student's base data.

Registration and matriculation numbers must be unique. Use UniqueField? indexes in catalog for both.

Test fails, I don't know why.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
5 edited

Legend:

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

    r6722 r6750  
    548548    grok.require('waeup.handleStudent')
    549549    form_fields = grok.AutoFields(IStudentBaseEdit).omit(
    550         'student_id', 'reg_number')
     550        'student_id', 'reg_number', 'matric_number')
    551551    grok.template('baseeditpage')
    552552    label = 'Change password'
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/containerpage.pt

    r6695 r6750  
    2323    <table class="display dataTableManage">
    2424      <thead>
    25         <tr>
    26           <th>Student Id</th><th>Name</th>
    27         </tr>
     25      <tr>
     26        <th>Student Id</th>
     27        <th>Registration Number</th>
     28        <th>Matriculation Number</th>
     29        <th>Name</th>
     30      </tr>
    2831      </thead>
    2932      <tbody>
    30         <tr tal:repeat="item view/hitlist">
    31           <td> <a tal:attributes="href item/url">
     33      <tr tal:repeat="item view/hitlist">
     34        <td> <a tal:attributes="href item/url">
    3235          <span tal:content="item/student_id">A123456</span></a>
    3336        </td>
    34           <td tal:content="item/name">Bob</td>
    35         </tr>
     37        <td> <a tal:attributes="href item/url">
     38          <span tal:content="item/reg_number">9999999</span></a>
     39        </td>
     40        <td> <a tal:attributes="href item/url">
     41          <span tal:content="item/matric_number">9999999</span></a>
     42        </td>
     43        <td tal:content="item/name">Bob</td>
     44      </tr>
    3645      </tbody>
    3746    </table>
  • main/waeup.sirp/trunk/src/waeup/sirp/students/catalog.py

    r6696 r6750  
    66from hurry.query.query import Query
    77from zope.index.text.parsetree import ParseError
     8from waeup.sirp.index import UniqueField
    89from waeup.sirp.interfaces import IUniversity, IQueryResultItem
    910from waeup.sirp.students.interfaces import IStudent
     
    1819    student_id = index.Field(attribute='student_id')
    1920    name = index.Text(attribute='name')
    20     reg_number = index.Field(attribute='reg_number')
     21    reg_number = UniqueField(attribute='reg_number')
     22    matric_number = UniqueField(attribute='matric_number')
    2123    state = index.Field(attribute='state')
    2224
     
    3335        self.name = context.name
    3436        self.reg_number = context.reg_number
     37        self.matric_number = context.matric_number
    3538        self.state = context.state
    3639
  • main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py

    r6744 r6750  
    8686        default = u'',
    8787        required = True,
     88        readonly = False,
     89        )
     90
     91    matric_number = schema.TextLine(
     92        title = u'Matriculation Number',
     93        default = u'',
     94        required = False,
    8895        readonly = False,
    8996        )
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r6714 r6750  
    3434from hurry.workflow.interfaces import IWorkflowInfo
    3535from waeup.sirp.testing import (
    36     FunctionalLayer, FunctionalTestCase, remove_logger,
    37     remove_new_loggers,
    38     )
     36    FunctionalLayer, FunctionalTestCase, remove_new_loggers,
     37   )
    3938from waeup.sirp.app import University
    4039from waeup.sirp.students.container import StudentsContainer
     
    7877        student = Student()
    7978        student.name = u'Anna Tester'
     79        student.reg_number = u'123'
     80        student.matric_number = u'234'
    8081        self.test_student_id = self.app['students'].addStudent(student)
    8182        # Set password
     
    164165        self.browser.getControl("Create student record").click()
    165166        self.assertTrue('Student record created' in self.browser.contents)
     167
     168        # Registration numbers must be unique
     169        self.browser.getLink("Manage").click()
     170        self.browser.getControl(name="form.reg_number").value = '123'
     171        self.browser.getControl("Save").click()
     172        self.assertMatches('...value already exists in catalog...',
     173                           self.browser.contents)
    166174
    167175        self.browser.open(self.container_path)
Note: See TracChangeset for help on using the changeset viewer.