Esempio n. 1
0
    def post(self):
        """ validate contact form """

        if not self.form.validate():
            return self.get(clear=False)
        name = self.form.supplier_name.data.strip()
        email = self.form.email.data.lower()
        phone = self.form.phone.data.strip()
        website = self.form.website.data.strip().lower()
        notes = self.form.notes.data.strip()

        new_supplier = Supplier(name=name,
                                email=email,
                                phone=phone,
                                website=website,
                                notes=notes)

        new_supplier.put()

        return self.get()
Esempio n. 2
0
 def get(self):
     data = Supplier.query().order(Supplier.name)
     return self.render_template('view_suppliers.html', table_data=data)