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")
else:
return _("[Unpublished] %s") % self.title
- @models.permalink
+ @silent_permalink
def get_absolute_url(self):
return ('static_page', (), {'path': self.extra['path']})
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 %}
<th class="sorted {{ added_at }}">
<a href="{{ added_at_link }}">{% trans "Added at" %}</a>
</th>
- <!--<th class="sorted {{ score }}">
+ {% comment %}
+ <th class="sorted {{ score }}">
<a href="{{ score_link }}">{% trans "Score" %}</a>
- </th>-->
+ </th>
+ {% endcomment %}
<th class="sorted {{ act_by }}">
<a href="{{ act_by_link }}">{% trans "Last activity by" %}</a>
</th>