示例#1
0
import web
from app import helpers
import app.db as db

render = helpers.render()

class list:
	def GET(self):
		items = db.get_all('client')
		title = 'All Clients'
		type = 'client'
		return render.list(items, title, type)
		
class new:

	form = web.form.Form(
		web.form.Textbox('name', web.form.notnull, size=60, description='Name:'),
		web.form.Textbox('address', web.form.notnull, size=60, description='Address:'),
		web.form.Textbox('city', web.form.notnull, size=60, description='City:'),
		web.form.Textbox('state', web.form.notnull, size=60, description='State:'),
		web.form.Textbox('zip_code', web.form.notnull, size=60, description='Zip:'),
		web.form.Textbox('phone', web.form.notnull, size=60, description='Phone:'),
		web.form.Textbox('email', web.form.notnull, size=60, description='Email:'),
		web.form.Textbox('contact', web.form.notnull, size=60, description='Contact name:'),
		web.form.Button('Submit Client')
	)

	def GET(self):
		form = self.form()
		type = 'client'
		title = 'New Client'
示例#2
0
import web
from app import helpers
import app.db as db

render = helpers.render()
render_print = helpers.render('')

class list:
	def GET(self):
		items = db.get_all('invoice')
		title = 'All Invoices'
		type = 'invoice'
		return render.list(items, title, type)
		
class new:

	clients = db.get_all('client')
	client_names = []
	for client in clients:
		client_names.append(client.name)
	
	form = web.form.Form(
		web.form.Textbox('title', web.form.notnull, size=60, description='Project title:'),
		web.form.Textbox('description', web.form.notnull, size=60, description='Project description:'),
		web.form.Dropdown('client', args=client_names, description='Client:'),
		web.form.Textbox('date', web.form.notnull, size=60, description='Date (YYYY-MM-DD):'),
		web.form.Button('Submit Invoice')
	)	

	def GET(self):
		form = self.form()