Exemplo n.º 1
0
    def GET(self):
        
                r = Restaurant()
                r_names = r.getRestaurantName()

                if not r_names :
                    return 'error - add a restaurant - ' 
                else :
                    nest = admin_view.menu_form.index(selectRestaurant)
                    return admin_view.index(nest)
Exemplo n.º 2
0
 def POST(self): 
         if not test_form.validates():
             nest = admin_view.addmenu(test_form)
             return admin_view.index(nest)
         else:
             number = test_form['number'].value
             if int(number) % 2:
                 return "Your number %s is odd." % number
             else:
                 return "Your number %s is even." % number
Exemplo n.º 3
0
 def POST(self): 
         if not addrestaurant_form.validates():
             nest = admin_view.addrestaurant(addrestaurant_form)
             return admin_view.index(nest)
         else:
             data = web.input()
             r = Restaurant()
             r.add(data.Name,
                        data.City, 
                        data.Phone, 
                        data.Address, 
                        data.State)
             return web.seeother('/admin/')
Exemplo n.º 4
0
 def POST(self):
             data = web.input()
             theForm = data.form
             
             validateForm = selectRestaurant()
             if theForm == 'selectRestaurant' :
                        if not validateForm.validates():
                                 nest = admin_view.menu_form.index( validateForm )
                                 return admin_view.index(nest)
                        else:
                                 data = web.input()
                                 m = Menu()
                                 menu_id = m.add(data.menu_name,
                                                 data.restaurant_name
                                                 )
                                 
                                 nest = admin_view.menu_form.categoryForm(categoryForm, menu_id)
                                 return admin_view.index(nest)
                             
             validateForm = categoryForm()
             if theForm == 'categoryForm' :
                       
                       if not data.menu_id == ""  :
                                menu_id_for_validation = data.menu_id
                     
                       if not validateForm.validates():
                                nest = admin_view.menu_form.categoryForm( validateForm, menu_id_for_validation )
                                return admin_view.index(nest)
                       else:
                                data = web.input()
                                c = Category()
                                c.add(data.add_categories,
                                        data.menu_id)
                                
                                mcm = Category()
                                mcm_names = mcm.getCategoryName(data.menu_id)
                                
                                nest = admin_view.menu_form.itemForm( itemForm, data.menu_id, mcm_names)
                                return admin_view.index(nest)
         
             validateForm = itemForm()
             if theForm == 'itemForm' :
                               mcm = Category()
                               mcm_names = mcm.getCategoryName(data.menu_id)
                               if not validateForm.validates() :
                                     nest = admin_view.menu_form.itemForm( validateForm, data.menu_id, mcm_names )
                                     return admin_view.index(nest)
                               else:
                                     data = web.input()
                                     items = Item()
                                     items.add(data.item_name,
                                                       data.item_desc,
                                                       data.item_price,
                                                       data.item_number,
                                                       data.category_name
                                               )
                                     
                                     nest = admin_view.menu_form.itemForm( itemForm, data.menu_id, mcm_names)
                                     return admin_view.index(nest)
Exemplo n.º 5
0
 def GET(self):
             nest = admin_view.addrestaurant(addrestaurant_form)
             return admin_view.index(nest)
Exemplo n.º 6
0
 def GET(self):
     #print users.create_logout_url("/admin/")
     return admin_view.index("nothing")
Exemplo n.º 7
0
 def GET(self):
             nest = admin_view.addmenu(test_form)
             return admin_view.index(nest)