Beispiel #1
0
	def get(self):
		if not isUserLoggedIn(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		itemKey = self.request.get('itemKey')
		item = WebshopItem.get(itemKey)
		template_values = {
			'item':item
		}
		template = jinja_environment.get_template('templates/webshop/webshopItemDetails.html')
		self.printPage("Rendelés részletei", template.render(template_values), True, True)
	def get(self):
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		items = WebshopItem.all().order('title')
		template_values = {
			'items':items
		}

		template = jinja_environment.get_template('templates/webshop/itemList.html')
		self.printPage("Termékek", template.render(template_values), True, True)
 def post(self):
     if not isUserLoggedIn(self):
         self.redirect("/")
         return
     user = getUser(self)
     aMenuQuantity = int(self.request.get("aMenu"))
     bMenuQuantity = int(self.request.get("bMenu"))
     makosQuantity = int(self.request.get("makos"))
     diosQuantity = int(self.request.get("dios"))
     addressKey = self.request.get("address")
     address = Address.get(addressKey)
     message = self.request.get("message")
     if aMenuQuantity > 0:
         aMenuItems = WebshopItem.all().filter("code = ", CHRISTMAS_LUNCH_A)
         aMenuItem = None
         if aMenuItems.count() == 1:
             aMenuItem = aMenuItems.get()
         christmasOrder = WebshopOrderItem()
         christmasOrder.address = address
         christmasOrder.orderDate = datetime.datetime.now()
         christmasOrder.orderQuantity = aMenuQuantity
         christmasOrder.item = aMenuItem
         christmasOrder.user = user
         if message != None and message != "":
             christmasOrder.comments = [message]
             christmasOrder.commentAuthors = ["Én"]
             christmasOrder.commentDates = [datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")]
         christmasOrder.put()
     if bMenuQuantity > 0:
         bMenuItems = WebshopItem.all().filter("code = ", CHRISTMAS_LUNCH_B)
         bMenuItem = None
         if bMenuItems.count() == 1:
             bMenuItem = bMenuItems.get()
         christmasOrder = WebshopOrderItem()
         christmasOrder.address = address
         christmasOrder.orderDate = datetime.datetime.now()
         christmasOrder.orderQuantity = bMenuQuantity
         christmasOrder.item = bMenuItem
         christmasOrder.user = user
         if message != None and message != "":
             christmasOrder.comments = [message]
             christmasOrder.commentAuthors = ["Én"]
             christmasOrder.commentDates = [datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")]
         christmasOrder.put()
     if makosQuantity > 0:
         makosItems = WebshopItem.all().filter("code = ", MAKOS_BEIGLI)
         makosItem = None
         if makosItems.count() == 1:
             makosItem = makosItems.get()
         christmasOrder = WebshopOrderItem()
         christmasOrder.address = address
         christmasOrder.orderDate = datetime.datetime.now()
         christmasOrder.orderQuantity = makosQuantity
         christmasOrder.item = makosItem
         christmasOrder.user = user
         if message != None and message != "":
             christmasOrder.comments = [message]
             christmasOrder.commentAuthors = ["Én"]
             christmasOrder.commentDates = [datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")]
         christmasOrder.put()
     if diosQuantity > 0:
         diosItems = WebshopItem.all().filter("code = ", DIOS_BEIGLI)
         diosItem = None
         if diosItems.count() == 1:
             diosItem = diosItems.get()
         christmasOrder = WebshopOrderItem()
         christmasOrder.address = address
         christmasOrder.orderDate = datetime.datetime.now()
         christmasOrder.orderQuantity = diosQuantity
         christmasOrder.item = diosItem
         christmasOrder.user = user
         if message != None and message != "":
             christmasOrder.comments = [message]
             christmasOrder.commentAuthors = ["Én"]
             christmasOrder.commentDates = [datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")]
         christmasOrder.put()
     self.redirect("/userOrderList")
    def get(self):
        if not isUserAdmin(self):
            self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
            self.redirect("/")
            return
        aMenus = WebshopItem.all().filter("code = ", CHRISTMAS_LUNCH_A)
        if aMenus.count() == 0:
            aMenu = WebshopItem()
            aMenu.code = CHRISTMAS_LUNCH_A
            aMenu.title = "Karácsonyi ebéd - A"
            aMenu.price = 2300
            aMenu.shortDescription = (
                "Szegedi halászlé harcsafilével, töltött káposzta, bejgli"
            )
            aMenu.description = (
                "Szegedi halászlé harcsafilével, töltött káposzta, bejgli"
            )
            aMenu.tags = ["Karácsony"]
            aMenu.put()
        bMenus = WebshopItem.all().filter("code = ", CHRISTMAS_LUNCH_B)
        if bMenus.count() == 0:
            bMenu = WebshopItem()
            bMenu.code = CHRISTMAS_LUNCH_B
            bMenu.title = "Karácsonyi ebéd - B"
            bMenu.price = 2600
            bMenu.shortDescription = "Szegedi halászlé harcsafilével, harcsapaprikás túróscsuszával, bejgli"
            bMenu.description = "Szegedi halászlé harcsafilével, harcsapaprikás túróscsuszával, bejgli"
            bMenu.tags = ["Karácsony"]
            bMenu.put()

        makoss = WebshopItem.all().filter("code = ", MAKOS_BEIGLI)
        if makoss.count() == 0:
            makos = WebshopItem()
            makos.code = MAKOS_BEIGLI
            makos.title = "Mákos beigli, 300g"
            makos.price = 1200
            makos.shortDescription = "Gluténmentes mákos beigli"
            makos.description = "Gluténmentes mákos beigli"
            makos.tags = ["Karácsony", "Beigli"]
            makos.put()

        dioss = WebshopItem.all().filter("code = ", DIOS_BEIGLI)
        if dioss.count() == 0:
            dios = WebshopItem()
            dios.code = DIOS_BEIGLI
            dios.title = "Diós beigli, 300g"
            dios.price = 1500
            dios.shortDescription = "Gluténmentes bejgli, valódi dióval"
            dios.description = "Gluténmentes bejgli, valódi dióval"
            dios.tags = ["Karácsony", "Beigli"]
            dios.put()

        self.printPage("Karácsonyi ebéd", "Sikeres inicializalas.", True, True)