pyalchemybiz/pyalchemybiz/controllers/customer.py

21 lines
545 B
Python
Raw Normal View History

import logging
from pyalchemybiz.lib.base import *
from pyalchemybiz.model import customer, meta
log = logging.getLogger(__name__)
class CustomerController(BaseController):
def index(self):
sess = meta.Session()
cust_q = sess.query(customer.Customer)
c.customers = cust_q.all()
return render('/customer.mako')
def edit(self, id):
sess = meta.Session()
cust_q = sess.query(customer.Customer)
c.customer = cust_q.filter(customer.Customer.id==id).one()
return c.customer