def get(self): delete = self.request.get("delete") if delete: account = db.get(delete) account.delete() q = PlaygrubAccount.all() accounts = q.fetch(100) template_values = {"accounts": accounts} path = os.path.join(os.path.dirname(__file__), "html/admin_accounts.html") self.response.out.write(template.render(path, template_values))
def post(self): service = self.request.get("service") user = self.request.get("user") password = self.request.get("password") q = PlaygrubAccount.gql("where service = :1", service) if q.count(1) > 0: account = q.fetch(1)[0] else: account = PlaygrubAccount() account.service = service account.user = user account.password = password db.put(account) q = PlaygrubAccount.all() accounts = q.fetch(100) template_values = {"accounts": accounts} path = os.path.join(os.path.dirname(__file__), "html/admin_accounts.html") self.response.out.write(template.render(path, template_values))