def get(self): if not super(BannerEdit, self).get(): return self.checkSession(self.request.headers.get('Cookie')) self.insertMenu() key = self.get_url_part(1) banner = Banner.get(key) self.insertTemplate("banners/banner.html", {'banner': banner}) self.drawPage()
def get(self): key = self.get_url_part(1) ban = Banner.get(key) self.response.headers['Content-Type'] = 'image' # self.response.headers['Expires'] = "Thu,01 Jan 2020 00:00:01 GMT" # self.response.headers['Cache-Control'] = "public" self.response.out.write(ban.image)
def get(self): if not super(BannerAll, self).get(): return self.checkSession(self.request.headers.get('Cookie')) self.insertMenu() banners = Banner.all() self.insertTemplate("banners/banners_list.html", {'banners': banners}) self.drawPage()
def post(self): if not super(BannerAdd, self).get(): return self.checkSession(self.request.headers.get('Cookie')) banner = Banner() banner.name = self.request.get('name') banner.link = self.request.get('link') banner.image = self.request.get('image') banner.put() self.showMessage("Баннер добавлен")
def post(self): if not super(BannerEdit, self).get(): return self.checkSession(self.request.headers.get('Cookie')) key = self.get_url_part(1) banner = Banner.get(key) banner.name = self.request.get('name') banner.link = self.request.get('link') if self.request.get('image'): banner.image = self.request.get('image') banner.put() self.showMessage("Баннер изменен")
def get_banner_by_number(self, number): return Banner.all()[number]
def get_banner_by_name(self, name): return Banner.gql("where name = :name", name=name)[0]
def count_banners(self): return Banner.all().count()