From: jordan Date: Fri, 10 Jun 2011 15:04:48 +0000 (+0000) Subject: removing score sort option from the bulk management tool in the administration, it... X-Git-Tag: live~252 X-Git-Url: https://git.openstreetmap.org/osqa.git/commitdiff_plain/850cd1bae1d672b13bdf0e9aa248dc6a5ec61293 removing score sort option from the bulk management tool in the administration, it used to cause some trouble with non-existing sort method, adding a silent permanent link decorator that checks whether the resolved URL exists git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1061 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/models/page.py b/forum/models/page.py index 665a1be..dcb9dfd 100644 --- a/forum/models/page.py +++ b/forum/models/page.py @@ -1,6 +1,25 @@ from base import * from django.utils.translation import ugettext as _ +def silent_permalink(func): + """ + Decorator that calls urlresolvers.reverse() to return a URL using + parameters returned by the decorated function "func". + + "func" should be a function that returns a tuple in one of the + following formats: + (viewname, viewargs) + (viewname, viewargs, viewkwargs) + """ + from django.core.urlresolvers import reverse + def inner(*args, **kwargs): + bits = func(*args, **kwargs) + try: + return reverse(bits[0], None, *bits[1:3]) + except: + return "javascript:alert('Configure this page URL in the urls.py file');" + return inner + class Page(Node): friendly_name = _("page") @@ -34,7 +53,7 @@ class Page(Node): else: return _("[Unpublished] %s") % self.title - @models.permalink + @silent_permalink def get_absolute_url(self): return ('static_page', (), {'path': self.extra['path']}) diff --git a/forum/skins/default/templates/osqaadmin/nodeman.html b/forum/skins/default/templates/osqaadmin/nodeman.html index ea97d12..ca86af5 100644 --- a/forum/skins/default/templates/osqaadmin/nodeman.html +++ b/forum/skins/default/templates/osqaadmin/nodeman.html @@ -435,7 +435,6 @@ added_at_link = current_sort == "added_at" and nodes.paginator.added_at_asc_sort_link or nodes.paginator.added_at_sort_link author_link = current_sort == "author_asc" and nodes.paginator.author_sort_link or nodes.paginator.author_asc_sort_link - score_link = current_sort == "score" and nodes.paginator.score_asc_sort_link or nodes.paginator.score_sort_link act_at_link = current_sort == "act_at" and nodes.paginator.act_at_asc_sort_link or nodes.paginator.act_at_sort_link act_by_link = current_sort == "act_by_asc" and nodes.paginator.act_by_sort_link or nodes.paginator.act_by_asc_sort_link {% enddeclare %} @@ -453,9 +452,11 @@ {% trans "Added at" %} - + + {% endcomment %} {% trans "Last activity by" %}