示例#1
0
文件: main.py 项目: blabaj/Guestbook
    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)
示例#2
0
    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)
示例#3
0
    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")
示例#4
0
    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)
示例#5
0
文件: main.py 项目: JanjaMIC/Naloga19
    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")
示例#6
0
 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)
示例#7
0
文件: main.py 项目: blabaj/Guestbook
 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")
示例#8
0
    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")
示例#9
0
文件: main.py 项目: JanjaMIC/Naloga19
    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)
示例#10
0
文件: main.py 项目: JanjaMIC/Naloga19
    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)
示例#11
0
    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)
示例#12
0
文件: main.py 项目: JanjaMIC/Naloga19
    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)
示例#13
0
文件: main.py 项目: JanjaMIC/Naloga19
    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)
示例#14
0
    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)
示例#15
0
    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."
        )
示例#16
0
文件: main.py 项目: tnt9/GuestBook
 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('/')
示例#17
0
文件: main.py 项目: tnt9/GuestBook
 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('/')
示例#18
0
文件: main.py 项目: tnt9/GuestBook
 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('/')
示例#19
0
文件: main.py 项目: tnt9/GuestBook
 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('/')
示例#20
0
文件: main.py 项目: tnt9/GuestBook
 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")
示例#21
0
文件: main.py 项目: tnt9/GuestBook
 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")
示例#22
0
 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")
示例#23
0
文件: main.py 项目: blabaj/Guestbook
    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)
示例#24
0
文件: main.py 项目: tnt9/GuestBook
    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()
示例#25
0
文件: views.py 项目: gardarh/petit
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)))
示例#26
0
 def get(self):
     entry = Guestbook.query().fetch()
     params = {}
     params["entries"] = entry
     return self.render_template("gaestebuch.html", params)
示例#27
0
 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)
示例#28
0
 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)
示例#29
0
    def get(self):
        guests = Guestbook.query(Guestbook.deleted == False).fetch()

        guestsbooks = { "guests": guests }

        return self.render_template("seznam_vnosov.html", params=guestsbooks)
示例#30
0
文件: main.py 项目: tnt9/GuestBook
 def post(self, guestbook_id):
     sporocilo = Guestbook.get_by_id(int(guestbook_id))
     sporocilo.key.delete()
     return self.redirect_to("seznam-izbrisanih-vnosov")
示例#31
0
文件: main.py 项目: tnt9/GuestBook
 def post(self, guestbook_id):
     sporocilo = Guestbook.get_by_id(int(guestbook_id))
     sporocilo.izbrisan = False
     sporocilo.put()
     return self.redirect_to("seznam-sporocil")
示例#32
0
 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")
示例#33
0
    def get(self):
        infoList = Guestbook.query(Guestbook.deleted == False).fetch()
        params = {"infoList": infoList}

        return self.render_template("guestBook.html", params)
示例#34
0
    def post(self, comment_id):
        comment = Guestbook.get_by_id(int(comment_id))
        comment.key.delete()

        return self.redirect_to("deletedComments")
示例#35
0
 def get(self):
     seznam = Guestbook.query().fetch()
     params = {"seznam": seznam}
     return self.render_template("seznam_sporocil.html", params=params)
示例#36
0
文件: main.py 项目: tnt9/GuestBook
 def post(self, guestbook_id):
     sporocilo = Guestbook.get_by_id(int(guestbook_id))
     sporocilo.izbrisan = False
     sporocilo.put()
     return self.redirect_to("seznam-sporocil")
示例#37
0
 def post(self, sporocilo_id):
     sporocilo = Guestbook.get_by_id(int(sporocilo_id))
     sporocilo.key.delete()
     return self.redirect_to("seznam-sporocil")
示例#38
0
 def get(self, comment_id):
     comment = Guestbook.get_by_id(int(comment_id))
     params = {"comment": comment}
     return self.render_template("edit.html", params)
示例#39
0
 def post(self, guestbook_id):
     guest = Guestbook.get_by_id(int(guestbook_id))
     guest.deleted = True
     guest.put()
     return self.redirect_to("seznam-vnosov")
示例#40
0
文件: main.py 项目: blabaj/Guestbook
    def get(self, vnos_id):

        vnos = Guestbook.get_by_id(int(vnos_id))
        params = {"vnos":vnos}
        return self.render_template("brisi.html", params)
示例#41
0
文件: main.py 项目: JanjaMIC/Naloga19
    def post(self, sporocilo_id):
        sporocilo = Guestbook.get_by_id(int(sporocilo_id))
        sporocilo.key.delete()

        self.redirect("/prikazi_vnose")
示例#42
0
    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)
示例#43
0
文件: main.py 项目: tnt9/GuestBook
 def post(self, guestbook_id):
     sporocilo = Guestbook.get_by_id(int(guestbook_id))
     sporocilo.key.delete()
     return self.redirect_to("seznam-izbrisanih-vnosov")
示例#44
0
 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")
示例#45
0
    def get(self):
        infoList = Guestbook.query(Guestbook.deleted == True).fetch()
        params = {"infoList": infoList}

        return self.render_template("deletedComments.html", params)
示例#46
0
文件: main.py 项目: blabaj/Guestbook
 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")