source: main/waeup.custom/trunk/src/waeup/custom/students/browser.py @ 7604

Last change on this file since 7604 was 7525, checked in by Henrik Bettermann, 13 years ago

Add more fields to student interfaces. Use these interfaces also for import.

  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
1## $Id: browser.py 7525 2012-01-27 18:24:31Z henrik $
2##
3## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18import grok
19from zope.formlib.textwidgets import BytesDisplayWidget
20from waeup.sirp.widgets.datewidget import (
21    FriendlyDateWidget, FriendlyDateDisplayWidget
22    )
23from waeup.custom.students.interfaces import (
24    IStudent, IStudentPersonal, IStudentClearance, IStudentClearanceEdit
25    )
26from waeup.sirp.students.browser import (
27    StudentPersonalDisplayFormPage, StudentPersonalManageFormPage,
28    StudentClearanceManageFormPage, StudentClearanceEditFormPage,
29    StudentClearanceDisplayFormPage
30    )
31
32class StudentPersonalDisplayFormPage(StudentPersonalDisplayFormPage):
33    """ Page to display student personal data
34    """
35    grok.context(IStudent)
36    form_fields = grok.AutoFields(IStudentPersonal)
37    form_fields['perm_address'].custom_widget = BytesDisplayWidget
38
39class StudentPersonalManageFormPage(StudentPersonalManageFormPage):
40    """ Page to edit student clearance data
41    """
42    grok.context(IStudent)
43    form_fields = grok.AutoFields(IStudentPersonal)
44
45class StudentClearanceDisplayFormPage(StudentClearanceDisplayFormPage):
46    """ Page to display student clearance data
47    """
48    grok.context(IStudent)
49    form_fields = grok.AutoFields(IStudentClearance).omit('clearance_locked')
50    form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
51
52class StudentClearanceManageFormPage(StudentClearanceManageFormPage):
53    """ Page to edit student clearance data
54    """
55    grok.context(IStudent)
56    form_fields = grok.AutoFields(IStudentClearance)
57    form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
58
59class StudentClearanceEditFormPage(StudentClearanceEditFormPage):
60    """ View to edit student clearance data by student
61    """
62    grok.context(IStudent)
63    form_fields = grok.AutoFields(
64        IStudentClearanceEdit).omit('clearance_locked')
65    form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
66
67
Note: See TracBrowser for help on using the repository browser.