def get(self): user = users.get_current_user() logout_url = users.create_logout_url("/") account = Account.get_by_user(user) pending_channels = Channel.get_all_by_target(account).filter("status =", "pending") enabled_channels = Channel.get_all_by_target(account).filter("status =", "enabled") self.response.out.write(template.render("templates/dashboard_sources.html", locals()))
def post(self): user = users.get_current_user() account = Account.get_by_user(user) action = self.request.get("action") if action == "approve": source = Account.get_by_hash(self.request.get("source")) channel = Channel.get_by_source_and_target(source, account) channel.status = "enabled" channel.put() if action == "disable": source = Account.get_by_hash(self.request.get("source")) channel = Channel.get_by_source_and_target(source, account) channel.status = "disabled" self.redirect("/dashboard/sources")