Changeset 6651 for main/waeup.sirp/trunk


Ignore:
Timestamp:
29 Aug 2011, 11:03:35 (13 years ago)
Author:
Henrik Bettermann
Message:

Generate student ids randomly (tests will follow).

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
1 added
4 edited

Legend:

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

    r6650 r6651  
    6767    IStudentPayments, IStudentAccommodation, IStudentNavigation
    6868    )
    69 from waeup.sirp.students.student import (
    70     Student,
    71     )
     69from waeup.sirp.students.student import Student
    7270from waeup.sirp.students.catalog import search
    7371
     
    228226    @grok.action('Create student record')
    229227    def addStudent(self, **data):
    230         student_id = self.request.form.get('form.student_id')
    231228        student = createObject(u'waeup.Student')
    232         student.student_id = student_id
    233229        self.applyData(student, **data)
    234230        try:
     
    238234            return
    239235        self.flash('Student record created.')
    240         self.redirect(self.url(self.context[student_id], 'index'))
     236        self.redirect(self.url(self.context[student.student_id], 'index'))
    241237        return
    242238
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/studentaddpage.pt

    r6631 r6651  
    66  <table>
    77    <tbody>
    8       <tr>
    9         <td><label for="form.student_id">Student Id:</label></td>
    10         <td>
    11          <input name="form.student_id" type="text" size="7" maxlength="7"
    12                 value="" />
    13         </td>
    14       </tr>
    158      <tr>
    169        <td><label for="form.name">Full Name:</label></td>
  • main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py

    r6648 r6651  
    2121    history = Attribute('Object history, a list of messages.')
    2222    state = Attribute('Returns the registration state of a student')
     23    student_id = Attribute('Randomly generated id')
    2324
    2425    def loggerInfo(ob_class, comment):
    2526        """Adds an INFO message to the log file
    2627        """
    27 
    28     student_id = schema.TextLine(
    29         title = u'Student Id',
    30         default = u'None',
    31         required = True,
    32         )
    3328
    3429    name = schema.TextLine(
     
    5146    """
    5247
    53     perm_address = schema.Date(
     48    perm_address = schema.Text(
    5449        title = u'Permanent Address',
    5550        required = False,
  • main/waeup.sirp/trunk/src/waeup/sirp/students/student.py

    r6642 r6651  
    2525from waeup.sirp.students.interfaces import IStudent, IStudentNavigation
    2626from waeup.sirp.utils.helpers import attrs_to_fields
     27from waeup.sirp.students.utils import generate_student_id
    2728
    2829class Student(grok.Container):
     
    3637        super(Student, self).__init__()
    3738        IWorkflowInfo(self).fireTransition('create')
     39        self.student_id = generate_student_id('?')
    3840        return
    3941
Note: See TracChangeset for help on using the changeset viewer.