Exemplo n.º 1
0
	def post(self):
		user = models.do_login(self.request.get("email"), self.request.get("password"), self)
		if user:
			self.redirect("/admin/")
		else:
			template_values = {}
			helpers.render_admin_template(self, "adminviews/home.html", template_values)
Exemplo n.º 2
0
  def get(self, status):
	messages = models.get_message_by_status(status)
	template_values = {
		'messages' : messages,
		'status' : status,
	}
	helpers.render_admin_template(self, "adminviews/list.html", template_values)
Exemplo n.º 3
0
  def get(self):
	count = models.get_unmoderated_count()
	messages = models.get_unmoderated_messages(500)
	template_values = {
		'messages' : messages,
		'count' : count,
	}
	helpers.render_admin_template(self, "adminviews/backlog.html", template_values)
Exemplo n.º 4
0
  def get(self, action, messageid):
	message = models.update_message_status(action, messageid)
	if action == "approve": 
		actiontext = "approved"
	else:
		actiontext = "blocked"
	template_values = {
		'message' : message,
		'actiontext' : actiontext,
	}
	helpers.render_admin_template(self, "adminviews/messageaction.html", template_values)
Exemplo n.º 5
0
  def get(self):
	messages = models.get_unmoderated_messages(5)
	messageset = ""
	for message in messages:
		messageset = messageset + "," + str(message.messageid)
	if len(messageset) == 0:
		messageset = False
	else:
		messageset = messageset[1:len(messageset)]
	template_values = {
		'messages' : messages,
		'messageset' : messageset,
	}
	helpers.render_admin_template(self, "adminviews/home.html", template_values)
Exemplo n.º 6
0
 def post(self):
     form = models.TweetForm(data=self.request.POST)
     if form.is_valid():
         logging.warn("got postcode: "+form.clean_data["postcode"])
         longitude, latitude = geo.get_geolocation(form.clean_data["postcode"])
         tweetpic = services.get_image(form.clean_data["tweetpic"])
         models.store_tweet(get_id_for_tweet(), form.clean_data["message"], 1, form.clean_data["username"], None, tweetpic, datetime.datetime.now(), longitude, latitude)
         self.redirect("/admin/")
     else:
         template_values = {
         "form": form
         }
         return helpers.render_admin_template(self, "adminviews/create_tweet.html", template_values)
Exemplo n.º 7
0
 def post(self):
     form = models.TweetForm(data=self.request.POST)
     if form.is_valid():
         logging.warn("got postcode: " + form.clean_data["postcode"])
         longitude, latitude = geo.get_geolocation(
             form.clean_data["postcode"])
         tweetpic = services.get_image(form.clean_data["tweetpic"])
         models.store_tweet(get_id_for_tweet(), form.clean_data["message"],
                            1, form.clean_data["username"], None, tweetpic,
                            datetime.datetime.now(), longitude, latitude)
         self.redirect("/admin/")
     else:
         template_values = {"form": form}
         return helpers.render_admin_template(
             self, "adminviews/create_tweet.html", template_values)
Exemplo n.º 8
0
 def get(self):
     template_values = {"form": models.TweetForm()}
     return helpers.render_admin_template(self,
                                          "adminviews/create_tweet.html",
                                          template_values)
Exemplo n.º 9
0
 def get(self):
     template_values = {
         "form": models.TweetForm()
     }
     return helpers.render_admin_template(self, "adminviews/create_tweet.html", template_values)