def get(self): if users.is_current_user_admin(): if self.request.GET: greetings = GbDB() if self.request.get('delgb'): greetings = GbDB.get_by_id(int(self.request.get('delgb'))) greetings.delete() self.redirect("/guestbook")
def post(self): user = users.get_current_user() if user: greeting = GbDB() greeting.author = user.nickname() if self.request.get('content'): content = self.request.get('content') greeting.content = content numchars = content.__len__() if numchars > 0 and numchars <= 1000: greeting.put() self.redirect('/guestbook') else: self.redirect("/guestbook")
def get(self): user = users.get_current_user() if user: form = True else: form = False if self.request.GET: show = self.request.get('show') if show == '': show = 0 else: show = Paging().Test_page(show) else: show = 0 show = int(show) greetings_query = GbDB.all().order('-date') paging = Paging().page(greetings_query, show) greetings = greetings_query.fetch(10, show) template_values = { 'paging':paging, 'greetings': greetings, 'form': form, } self.generate('guestbook.html', template_values, razdel = 'guestbook', logo = 'logo', title = 'Гостевая');
def get(self): user = users.get_current_user() if user: if self.request.get('postid'): post = GbDB.get_by_id(int(self.request.get('postid'))) if post: template_values = { 'greeting': post, } self.generate('guestbook.cit.html', template_values, razdel = '', logo = 'logo', title = 'Гостевая'); else: self.redirect("/guestbook") else: self.redirect("/guestbook") else: self.redirect("/guestbook")