Exemple #1
0
	def POST(self, id):
		form = new.form()
		invoice = db.get_from_table('invoice', int(id))
		if not form.validates():
			return render.edit(invoice, form)
		client = db.get_client_id(form.d.client)
		db.update('invoice', id,
			project_title=form.d.title,
			description=form.d.description,
			client_id=client,
			date=form.d.date
		)
		raise web.seeother('/invoices')
Exemple #2
0
	def POST(self):
		form = self.form()
		if not form.validates():
			title = 'New Invoice'
			type = 'invoice'
			return render.new(form, title, type)
		client = db.get_client_id(form.d.client)
		db.new('invoice', 
			project_title=form.d.title, 
			description=form.d.description, 
			client_id=client, 
			date=form.d.date
		)
		raise web.seeother('/invoices')