forked from btbytes/teh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.py
42 lines (36 loc) · 1.1 KB
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
# encoding: utf-8
"""
admin.py
Created by Pradeep Gowda on 2008-05-04.
Copyright (c) 2008 Yashotech. All rights reserved.
"""
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from google.appengine.api import users
from utils import TehRequestHandler, administrator
from blog import Entry
class AdminHandler(TehRequestHandler):
@administrator
def get(self):
self.render("templates/admin.html")
class EntryListHandler(TehRequestHandler):
@administrator
def get(self):
entries = Entry.all().order("-published")
self.render("templates/admin_entrylist.html",
entries=entries)
class ConfigHandler(TehRequestHandler):
@administrator
def get(self):
self.render("templates/config.html")
@administrator
def post(self):
config = Config.all()
config = config.fetch(1)[0]
config.title = self.request.get("title")
config.disqus = self.request.get("disqus")
config.put()
self.redirect('/')