Ignore:
Timestamp:
10 Jun 2011, 10:20:44 (13 years ago)
Author:
Henrik Bettermann
Message:

Implement ApplicantAddFormPage?.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/applicants
Files:
2 edited

Legend:

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

    r6325 r6327  
    359359    @grok.action('Add applicant', validator=NullValidator)
    360360    def addApplicant(self, **data):
    361         return self.flash('Manual addition of applicants not yet implemented!')
     361        self.redirect(self.url(self.context, 'addapplicant'))
     362        return
    362363
    363364    @grok.action('Cancel', validator=NullValidator)
     
    426427        return
    427428
     429class ApplicantAddFormPage(WAeUPAddFormPage):
     430    """Add-form to add certificate to a department.
     431    """
     432    grok.context(IApplicantsContainer)
     433    grok.require('waeup.manageApplications')
     434    grok.name('addapplicant')
     435    grok.template('applicantaddpage')
     436    title = 'Applicants'
     437    label = 'Add applicant'
     438    pnav = 3
     439
     440    @property
     441    def title(self):
     442        return "Applicants Container: %s" % self.context.title
     443
     444    @property
     445    def ac_prefix(self):
     446        return self.context.ac_prefix
     447
     448    @grok.action('Create application record')
     449    def addApplicant(self, **data):
     450        ac_series = self.request.form.get('form.ac_series', None)
     451        ac_number = self.request.form.get('form.ac_number', None)
     452        pin = '%s-%s-%s' % (self.ac_prefix,ac_series,ac_number)
     453        if pin not in self.context.keys():
     454            # Create applicant record
     455            applicant = Applicant()
     456            applicant.access_code = pin
     457            self.context[pin] = applicant
     458        self.redirect(self.url(self.context[pin], 'edit'))
     459        return
     460
    428461class AccessCodeLink(LeftSidebarLink):
    429462    grok.order(1)
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py

    r6324 r6327  
    284284    """
    285285    msgs = Attribute('Workflow transitions with date of transition.')
     286    getApplicationState = Attribute('Returns the application state of an applicant')
    286287
    287288    reg_no = schema.TextLine(
     
    388389        default = False,
    389390        )
    390 
    391     def getApplicationState():
    392         """
    393         Returns the application state of an applicant.
    394         """
    395391
    396392class IApplicant(IApplicantBaseData):
Note: See TracChangeset for help on using the changeset viewer.