removed "/polls/" from the poll links
This commit is contained in:
parent
0bf5bead5c
commit
e9010e8342
1 changed files with 12 additions and 22 deletions
|
@ -113,19 +113,19 @@ class Poll(sqlobject.SQLObject):
|
||||||
self.destroySelf()
|
self.destroySelf()
|
||||||
|
|
||||||
def get_url(self):
|
def get_url(self):
|
||||||
return "%spolls/%s" % (BASE_DICT["base_url"], self.hash_key)
|
return "%s%s" % (BASE_DICT["base_url"], self.hash_key)
|
||||||
|
|
||||||
def get_submit_url(self):
|
def get_submit_url(self):
|
||||||
return "%spolls/%s/submit" % (BASE_DICT["base_url"], self.hash_key)
|
return "%s%s/submit" % (BASE_DICT["base_url"], self.hash_key)
|
||||||
|
|
||||||
def get_admin_url(self):
|
def get_admin_url(self):
|
||||||
return "%spolls/%s" % (BASE_DICT["base_url"], self.admin_hash_key)
|
return "%s%s" % (BASE_DICT["base_url"], self.admin_hash_key)
|
||||||
|
|
||||||
def get_edit_url(self):
|
def get_edit_url(self):
|
||||||
return "%spolls/%s/admin" % (BASE_DICT["base_url"], self.admin_hash_key)
|
return "%s%s/admin" % (BASE_DICT["base_url"], self.admin_hash_key)
|
||||||
|
|
||||||
def get_delete_url(self):
|
def get_delete_url(self):
|
||||||
return "%spolls/%s/delete" % (BASE_DICT["base_url"], self.admin_hash_key)
|
return "%s%s/delete" % (BASE_DICT["base_url"], self.admin_hash_key)
|
||||||
|
|
||||||
def get_creation_time_string(self):
|
def get_creation_time_string(self):
|
||||||
return str(self.timestamp_creation)
|
return str(self.timestamp_creation)
|
||||||
|
@ -196,9 +196,9 @@ def get_new_hash_key(length=16, charset=None):
|
||||||
hash_key = get_hash_string(length)
|
hash_key = get_hash_string(length)
|
||||||
return hash_key
|
return hash_key
|
||||||
|
|
||||||
@bobo.query('/polls/new')
|
@bobo.query('/new')
|
||||||
@bobo.query('/polls/new/:setting_defaults')
|
@bobo.query('/new/:setting_defaults')
|
||||||
@bobo.query('/polls/new/:author/:title/:description')
|
@bobo.query('/new/:author/:title/:description')
|
||||||
def new_poll(submit=None, cancel=None, setting_defaults=None, author=None, title=None, description=None):
|
def new_poll(submit=None, cancel=None, setting_defaults=None, author=None, title=None, description=None):
|
||||||
# TODO: implement "setting_defaults" for different (pre-defined) categories of polls
|
# TODO: implement "setting_defaults" for different (pre-defined) categories of polls
|
||||||
value_dict = get_default_values()
|
value_dict = get_default_values()
|
||||||
|
@ -226,7 +226,7 @@ def new_poll(submit=None, cancel=None, setting_defaults=None, author=None, title
|
||||||
new_poll = Poll(hash_key=hash_key, admin_hash_key=admin_hash_key, timestamp_creation=now, **data)
|
new_poll = Poll(hash_key=hash_key, admin_hash_key=admin_hash_key, timestamp_creation=now, **data)
|
||||||
return bobo.redirect(new_poll.get_admin_url())
|
return bobo.redirect(new_poll.get_admin_url())
|
||||||
|
|
||||||
@bobo.query('/polls/:hash_key/submit')
|
@bobo.query('/:hash_key/submit')
|
||||||
def submit_content(hash_key=None, submitter=None, content=None):
|
def submit_content(hash_key=None, submitter=None, content=None):
|
||||||
value_dict = get_default_values()
|
value_dict = get_default_values()
|
||||||
data = {"submitter": submitter, "content": content}
|
data = {"submitter": submitter, "content": content}
|
||||||
|
@ -252,7 +252,7 @@ def submit_content(hash_key=None, submitter=None, content=None):
|
||||||
return render("poll_details.html", input_data=data, **value_dict)
|
return render("poll_details.html", input_data=data, **value_dict)
|
||||||
return bobo.redirect(BASE_DICT["base_url"])
|
return bobo.redirect(BASE_DICT["base_url"])
|
||||||
|
|
||||||
@bobo.query('/polls/:admin_hash_key/delete')
|
@bobo.query('/:admin_hash_key/delete')
|
||||||
def delete_poll(admin_hash_key=None):
|
def delete_poll(admin_hash_key=None):
|
||||||
admin_poll_id = get_poll_admin_id(admin_hash_key)
|
admin_poll_id = get_poll_admin_id(admin_hash_key)
|
||||||
if not admin_poll_id is None:
|
if not admin_poll_id is None:
|
||||||
|
@ -260,7 +260,7 @@ def delete_poll(admin_hash_key=None):
|
||||||
poll.delete_poll()
|
poll.delete_poll()
|
||||||
return bobo.redirect(BASE_DICT["base_url"])
|
return bobo.redirect(BASE_DICT["base_url"])
|
||||||
|
|
||||||
@bobo.query('/polls/:admin_hash_key/admin')
|
@bobo.query('/:admin_hash_key/admin')
|
||||||
def admin_poll(cancel=False, submit=None, admin_hash_key=None, author=None, title=None, description=None, **kwargs):
|
def admin_poll(cancel=False, submit=None, admin_hash_key=None, author=None, title=None, description=None, **kwargs):
|
||||||
value_dict = get_default_values()
|
value_dict = get_default_values()
|
||||||
data = {"author": author, "title": title, "description": description}
|
data = {"author": author, "title": title, "description": description}
|
||||||
|
@ -319,23 +319,13 @@ def admin_poll(cancel=False, submit=None, admin_hash_key=None, author=None, titl
|
||||||
def base():
|
def base():
|
||||||
return bobo.redirect(BASE_DICT["base_url"])
|
return bobo.redirect(BASE_DICT["base_url"])
|
||||||
|
|
||||||
@bobo.query('/polls')
|
|
||||||
def base_polls():
|
|
||||||
return bobo.redirect(BASE_DICT["base_url"] + "polls/")
|
|
||||||
|
|
||||||
@bobo.query('/')
|
@bobo.query('/')
|
||||||
def show_frontpage():
|
def show_frontpage():
|
||||||
value_dict = get_default_values()
|
value_dict = get_default_values()
|
||||||
value_dict["polls"] = Poll.select()
|
value_dict["polls"] = Poll.select()
|
||||||
return render("frontpage.html", **value_dict)
|
return render("frontpage.html", **value_dict)
|
||||||
|
|
||||||
@bobo.query('/polls/')
|
@bobo.query('/:poll_hash')
|
||||||
def show_polls():
|
|
||||||
value_dict = get_default_values()
|
|
||||||
value_dict["polls"] = Poll.select()
|
|
||||||
return render("polls.html", **value_dict)
|
|
||||||
|
|
||||||
@bobo.query('/polls/:poll_hash')
|
|
||||||
def show_one_poll(poll_hash=None):
|
def show_one_poll(poll_hash=None):
|
||||||
value_dict = get_default_values()
|
value_dict = get_default_values()
|
||||||
poll_id = get_poll_id(poll_hash)
|
poll_id = get_poll_id(poll_hash)
|
||||||
|
|
Loading…
Reference in a new issue