source: main/kofacustom.pcn/trunk/src/kofacustom/pcn/applicants/browser.py @ 17951

Last change on this file since 17951 was 11844, checked in by Henrik Bettermann, 10 years ago

Customize pdf slip. Add logo and watermark.

  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1## $Id: browser.py 11844 2014-10-15 07:06:39Z henrik $
2##
3## Copyright (C) 2011 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##
18"""UI components for basic applicants and related components.
19"""
20import grok
21from waeup.kofa.widgets.datewidget import (
22    FriendlyDateDisplayWidget, FriendlyDateDisplayWidget,)
23from waeup.kofa.applicants.browser import (
24    ApplicantRegistrationPage,
25    ApplicantsContainerPage,
26    ApplicantDisplayFormPage,
27    ApplicantManageFormPage,
28    ApplicantEditFormPage,
29    )
30from waeup.kofa.applicants.pdf import PDFApplicationSlip
31from waeup.kofa.applicants.viewlets import (
32    StudentCreateActionButton,
33    ApplicantsRootCreateStudentsActionButton,
34    )
35from kofacustom.pcn.applicants.interfaces import (
36    ICustomApplicant, ICustomApplicantEdit)
37from kofacustom.pcn.interfaces import MessageFactory as _
38
39class StudentCreateActionButton(StudentCreateActionButton):
40
41    @property
42    def target_url(self):
43        """Get a URL to the target...
44        """
45        return
46
47class ApplicantsRootCreateStudentsActionButton(ApplicantsRootCreateStudentsActionButton):
48
49    @property
50    def target_url(self):
51        """Get a URL to the target...
52        """
53        return
54
55class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage):
56    """A display view for applicant data.
57    """
58    grok.template('applicantdisplaypage')
59
60    @property
61    def form_fields(self):
62        form_fields = grok.AutoFields(ICustomApplicant).omit(
63            'locked', 'course_admitted', 'password', 'suspended')
64        return form_fields
65
66class CustomApplicantManageFormPage(ApplicantManageFormPage):
67    """A full edit view for applicant data.
68    """
69    grok.template('applicanteditpage')
70
71    @property
72    def form_fields(self):
73        form_fields = grok.AutoFields(ICustomApplicant)
74        form_fields['applicant_id'].for_display = True
75        return form_fields
76
77class CustomApplicantEditFormPage(ApplicantEditFormPage):
78    """An applicant-centered edit view for applicant data.
79    """
80    grok.template('applicanteditpage')
81
82    @property
83    def form_fields(self):
84        form_fields = grok.AutoFields(ICustomApplicantEdit).omit(
85            'locked', 'course_admitted',
86            'suspended'
87            )
88        form_fields['applicant_id'].for_display = True
89        form_fields['reg_number'].for_display = True
90        return form_fields
91
92class CustomPDFApplicationSlip(PDFApplicationSlip):
93    """Bypass NigeriaPDFApplicationSlip
94    """
95
96    form_fields =  grok.AutoFields(ICustomApplicant).omit(
97        'locked', 'course_admitted', 'suspended', 'sex', 'course2'
98        )
99    form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
Note: See TracBrowser for help on using the repository browser.