Example #1
0
    def add(self, scholarship, data):
        application = ScholarshipApplication(parent=scholarship.key)

        del data['csrfmiddlewaretoken']

        #application.save(**data)
        try:
            application.populate(**data)
            application.put()
        except BadValueError as bve:
            field_name = bve.message.split(': ')[1]
            msg = 'The value for the field "{0}" is required.'.format(field_name)
            self.result.add_error(msg)
            return application
        except TypeError as te:
            self.result.add_error(te.message)
            return application

        self.send_email(application)

        return application
Example #2
0
 def get_current_applications(self):
     applications = ScholarshipApplication.query().fetch(100)
     return applications