def get(self): session = get_current_session() if session.is_active(): present = Present.get(self.request.get('key')) if present.user == session["user_info"]["username"]: present.delete() #increment counter counter = PresentCounter.all().fetch(1)[0] counter.count -= 1 counter.put() self.redirect('/?msg=deleteOk')
def get(self): session = get_current_session() if session.is_active(): present = Present.get(self.request.get('key')) if present.user == session["user_info"]["username"]: present.delete(); #increment counter counter = PresentCounter.all().fetch(1)[0] counter.count -= 1 counter.put() self.redirect('/?msg=deleteOk')
def post(self): session = get_current_session() if session.is_active() and self.request.get('title'): present = Present(title=self.request.get('title'), user=session["user_info"]["username"]) if self.request.get('approximatePrice'): present.approximatePrice = int(self.request.get('approximatePrice')) if self.request.get('url'): present.url = self.request.get('url') if self.request.get('image'): present.image = self.request.get('image') present.imageFixed = False present.put() #increment counter try: counter = PresentCounter.all().fetch(1)[0] except: counter = PresentCounter(count=0) counter.count += 1 counter.put() self.redirect('/?msg=addOk')
def post(self): session = get_current_session() if session.is_active() and self.request.get('title'): present = Present(title=self.request.get('title'), user=session["user_info"]["username"]) if self.request.get('approximatePrice'): present.approximatePrice = int( self.request.get('approximatePrice')) if self.request.get('url'): present.url = self.request.get('url') if self.request.get('image'): present.image = self.request.get('image') present.imageFixed = False present.put() #increment counter try: counter = PresentCounter.all().fetch(1)[0] except: counter = PresentCounter(count=0) counter.count += 1 counter.put() self.redirect('/?msg=addOk')