def post(self): user = users.get_current_user() if user: logiran = True logout_url = users.create_logout_url('/') params = {"logiran": logiran, "logout_url": logout_url, "user": user} else: logiran = False login_url = users.create_login_url('/') params = {"logiran": logiran, "login_url": login_url, "user": user} ime = user.nickname() email = user.email() sporocilo = self.request.get("sporocilo") if (len(sporocilo) == 0 or len(sporocilo.strip(' ')) == 0): napaka = {"napaka":"Vsebina sporocila je potrebna!"} return self.render_template("gosti.html", napaka) vnos = Guestbook(ime=ime, email=email, sporocilo=sporocilo) vnos.put() #pridobivanje vseh vnosov vnosi = Guestbook.query().fetch() params.update({"vnosi":vnosi}) return self.render_template("gosti.html", params)
def post(self): firstName = self.request.get("firstName") lastName = self.request.get("lastName") mail = self.request.get("mail") message = self.request.get("message") listOfValues = [ firstName.lower(), lastName.lower(), mail.lower(), message.lower() ] if "<script>" in listOfValues: return self.render_template("error.html") else: guestbook = Guestbook(name=firstName, surname=lastName, email=mail, message=message) guestbook.put() params = { "firstName": firstName, "lastName": lastName, "mail": mail, "message": message } return self.render_template("processed.html", params)
def post(self): uporabnikovo_ime = self.request.get("ime") uporabnikov_priimek = self.request.get("priimek") uporabnikov_email = self.request.get("email") uporabnikovo_sporocilo = self.request.get("sporocilo") ustvarjeno = self.request.get("ustvarjeno") guestbook = Guestbook(ime=uporabnikovo_ime, priimek=uporabnikov_priimek, email=uporabnikov_email, sporocilo=uporabnikovo_sporocilo, ustvarjeno=ustvarjeno) guestbook.put() return self.render_template("guestbook_poslano.html")
def post(self): ime = self.request.get("ime") priimek = self.request.get("priimek") email = self.request.get("email") message = self.request.get("sporocilo") date = self.request.get("datum") guestbook = Guestbook(name=ime, surname=priimek, email=email, message=message) guestbook.put() return self.write("You have written: " + "\n" + " name: " + ime + " surname: " + priimek + " email: " + email + " message: " + message)
def post(self): uporabnikovo_ime = self.request.get("ime") uporabnikov_priimek = self.request.get("priimek") uporabnikov_email = self.request.get("email") uporabnikovo_sporocilo = self.request.get("tekst") if uporabnikovo_ime == "": uporabnikovo_ime = "neznanec" sporocilo = Guestbook(ime=uporabnikovo_ime, priimek=uporabnikov_priimek, email=uporabnikov_email, tekst=uporabnikovo_sporocilo) sporocilo.put() return self.render_template("guestbook_poslano.html")
def post(self): params = {} name = self.request.get("name") if name == None: name = "Anonymous" else: name = name email = self.request.get("email") comment = self.request.get("comment") params.update({"name": name, "email": email, "comment": comment}) entry = Guestbook(name=params["name"], email=params["email"], text=params["comment"]) entry.put() return self.render_template("comment.html", params)
def post(self, vnos_id): vnos = Guestbook.get_by_id(int(vnos_id)) vrednost_vnosa = self.request.get("sporocilo") vnos.sporocilo = vrednost_vnosa vnos.put() time.sleep(0.1) return self.redirect_to("seznam-vnosov")
def post(self, comment_id): edit = self.request.get("message") comment = Guestbook.get_by_id(int(comment_id)) comment.message = edit comment.put() return self.redirect_to("guestbook")
def post(self, sporocilo_id): sporocilo = Guestbook.get_by_id(int(sporocilo_id)) sporocilo.ime = self.request.get("ime") sporocilo.tekst = self.request.get("tekst") sporocilo.put() self.redirect("/sporocilo/" + sporocilo_id)
def get(self, sporocilo_id): sporocilo = Guestbook.get_by_id(int(sporocilo_id)) view_vars = { "sporocilo": sporocilo } return self.render_template("izbrisi_sporocilo.html", view_vars)
def get(self, guestbook_id): guestbook = Guestbook.get_by_id(int(guestbook_id)) view_vars = { "guestbook": guestbook } return self.render_template("posamezen_vnos.html", view_vars)
def get(self): vsi_vnosi = Guestbook.query().order(Guestbook.ustvarjeno).fetch() view_vars = { "vsi_vnosi": vsi_vnosi } return self.render_template("prikazi_vnose.html", view_vars)
def get(self, sporocilo_id): sporocilo = Guestbook.get_by_id(int(sporocilo_id)) view_vars = { "sporocilo": sporocilo } return self.render_template("posamezen_vnos.html", view_vars)
def get(self): vsa_sporocila = Guestbook.query().order(Guestbook.nastanek).fetch() view_vars = { "vsa_sporocila": vsa_sporocila } return self.render_template("prikazi_sporocila.html", view_vars)
def post(self): ime = self.request.get("ime") priimek = self.request.get("priimek") email = self.request.get("email") sporocilo = self.request.get("sporocilo") # datum = self.request.get("nastanek") # datume generira avtomaticno sporocilo = cgi.escape(sporocilo) # prepreci javascript injection guestbook = Guestbook(ime=ime, priimek=priimek, email=email, sporocilo=sporocilo) guestbook.put() return self.write( "You have successfully added your message...click back on your browser." )
def get(self, guestbook_id): user = users.get_current_user() if user: self.write(user.email()) if user.email() == "*****@*****.**": sporocilo = Guestbook.get_by_id(int(guestbook_id)) params = {"sporocilo": sporocilo} return self.render_template("restore_vnos.html", params=params) else: return self.rendirect_to('/')
def get(self, guestbook_id): user = users.get_current_user() if user: self.write(user.email()) if user.email() == "*****@*****.**": sporocilo = Guestbook.get_by_id(int(guestbook_id)) params = {"sporocilo": sporocilo} return self.render_template("uredi_vnos.html", params=params) else: return self.rendirect_to('/')
def get(self): user = users.get_current_user() if user: self.write(user.email()) if user.email() == "*****@*****.**": seznam = Guestbook.query(Guestbook.izbrisan == False).order(Guestbook.priimek).fetch() params = {"seznam": seznam} return self.render_template("seznam_sporocil.html", params=params) else: return self.rendirect_to('/')
def get(self): user = users.get_current_user() if user: self.write(user.email()) if user.email() == "*****@*****.**": seznam = Guestbook.query(Guestbook.izbrisan == False).order( Guestbook.priimek).fetch() params = {"seznam": seznam} return self.render_template("seznam_sporocil.html", params=params) else: return self.rendirect_to('/')
def post(self, guestbook_id): ime = self.request.get("ime") priimek = self.request.get("priimek") email = self.request.get("email") message = self.request.get("message") sporocilo = Guestbook.get_by_id(int(guestbook_id)) sporocilo.ime = ime sporocilo.priimek = priimek sporocilo.email = email sporocilo.message = message sporocilo.put() return self.redirect_to("seznam-sporocil")
def post(self, guestbook_id): ime = self.request.get("change_name") priimek = self.request.get("change_surname") email = self.request.get("change_email") sporocilo = self.request.get("change_message") guest = Guestbook.get_by_id(int(guestbook_id)) #guest.Guestbook = Guestbook(name=ime, surname=priimek, email=email, message=sporocilo) guest.name = ime guest.surname = priimek guest.email = email guest.message = sporocilo guest.put() return self.redirect_to("seznam-vnosov")
def get(self): user = users.get_current_user() if user: logiran = True logout_url = users.create_logout_url('/') params = {"logiran": logiran, "logout_url": logout_url, "user": user} else: logiran = False login_url = users.create_login_url('/') params = {"logiran": logiran, "login_url": login_url, "user": user} vnosi = Guestbook.query().fetch() params.update({"vnosi":vnosi}) return self.render_template("gosti.html", params)
def post(self): ime = self.request.get("ime") if ime == "": ime = "N/A" priimek = self.request.get("priimek") if priimek == "": priimek = "N/A" email = self.request.get("email") message = self.request.get("text") if message: guestbook = Guestbook(ime=ime, priimek=priimek, email=email, message=message) # guestbook.put() # return self.write(guestbook) params = {"guestbook": guestbook} return self.render_template("vnos.html", params=params) else: error = True return self.get()
def guestbook(request): instance = Guestbook(display=True,ip=request.META.get('HTTP_X_REAL_IP',request.META['REMOTE_ADDR'])) guestbook_form = GuestbookForm(instance=instance) start_at = max(int(request.GET.get('start_at','0')),0) items_per_page = 20 if request.method == "POST": guestbook_form = GuestbookForm(request.POST, instance=instance) if guestbook_form.is_valid(): guestbook_form.save(request) messages.success(request, _("Guestbook entry added")) return HttpResponseRedirect('/guestbook/') context = { 'guestbook_form': guestbook_form , 'entries': Guestbook.objects.filter(display=True).order_by('-date')[start_at:start_at+items_per_page] , 'display_next_page':len(Guestbook.objects.filter(display=True).order_by('-date')[start_at+items_per_page:]) > 0 , 'display_last_page':start_at>0 , 'next_startat':start_at+items_per_page , 'last_startat':max(start_at-items_per_page,0) } return HttpResponse(loader.get_template("guestbook.html").render(RequestContext(request,context)))
def get(self): entry = Guestbook.query().fetch() params = {} params["entries"] = entry return self.render_template("gaestebuch.html", params)
def get(self, guestbook_id): guest = Guestbook.get_by_id(int(guestbook_id)) params = { "guest": guest } return self.render_template("izbrisi_vnos.html", params=params)
def get(self, sporocilo_id): sporocilo = Guestbook.get_by_id(int(sporocilo_id)) params = {"sporocilo": sporocilo} return self.render_template("uredi_sporocilo.html", params=params)
def get(self): guests = Guestbook.query(Guestbook.deleted == False).fetch() guestsbooks = { "guests": guests } return self.render_template("seznam_vnosov.html", params=guestsbooks)
def post(self, guestbook_id): sporocilo = Guestbook.get_by_id(int(guestbook_id)) sporocilo.key.delete() return self.redirect_to("seznam-izbrisanih-vnosov")
def post(self, guestbook_id): sporocilo = Guestbook.get_by_id(int(guestbook_id)) sporocilo.izbrisan = False sporocilo.put() return self.redirect_to("seznam-sporocil")
def post(self, comment_id): comment = Guestbook.get_by_id(int(comment_id)) comment.deleted = True comment.put() #comment.key.delete() za enostavno brisanje iz baze return self.redirect_to("guestbook")
def get(self): infoList = Guestbook.query(Guestbook.deleted == False).fetch() params = {"infoList": infoList} return self.render_template("guestBook.html", params)
def post(self, comment_id): comment = Guestbook.get_by_id(int(comment_id)) comment.key.delete() return self.redirect_to("deletedComments")
def get(self): seznam = Guestbook.query().fetch() params = {"seznam": seznam} return self.render_template("seznam_sporocil.html", params=params)
def post(self, sporocilo_id): sporocilo = Guestbook.get_by_id(int(sporocilo_id)) sporocilo.key.delete() return self.redirect_to("seznam-sporocil")
def get(self, comment_id): comment = Guestbook.get_by_id(int(comment_id)) params = {"comment": comment} return self.render_template("edit.html", params)
def post(self, guestbook_id): guest = Guestbook.get_by_id(int(guestbook_id)) guest.deleted = True guest.put() return self.redirect_to("seznam-vnosov")
def get(self, vnos_id): vnos = Guestbook.get_by_id(int(vnos_id)) params = {"vnos":vnos} return self.render_template("brisi.html", params)
def post(self, sporocilo_id): sporocilo = Guestbook.get_by_id(int(sporocilo_id)) sporocilo.key.delete() self.redirect("/prikazi_vnose")
def post(self): # shranjevanje user emaila v sporocilo model user_email = user.email() save_user_email = Guestbook(sporocilo=user_email) save_user_email.put() return self.render_template("hello.html", params)
def post(self, sporocilo_id): vnos = self.request.get("vnos") sporocilo = Guestbook.get_by_id(int(sporocilo_id)) sporocilo.sporocilo = vnos sporocilo.put() return self.redirect_to("seznam-sporocil")
def get(self): infoList = Guestbook.query(Guestbook.deleted == True).fetch() params = {"infoList": infoList} return self.render_template("deletedComments.html", params)
def post(self, vnos_id): vnos = Guestbook.get_by_id(int(vnos_id)) vnos.key.delete() time.sleep(0.1) return self.redirect_to("seznam-vnosov")