section_name

This commit is contained in:
James Turk 2010-04-05 14:23:26 -04:00
parent ec9f0a3895
commit 0a3f74eee7
2 changed files with 8 additions and 1 deletions

View File

@ -37,6 +37,11 @@ class Article(models.Model):
def display_title(self):
return self.title.rsplit('/',1)[-1].replace('_', ' ')
@property
def section_name(self):
if '/' in self.title:
return self.title.rsplit('/',1)[0]
def get_absolute_url(self):
return reverse('view_article', args=[self.title])

View File

@ -31,7 +31,9 @@
<h2 class="article_title">
{% block article_title %}
{{article.display_title}}
{% if article.section_name %}<a href="{% url view_article article.section_name %}">{{article.section_name}}</a> / {% endif %}
{{article.display_title}}
{% if article.is_deleted %} [deleted] {% endif %}
{% if not version.is_latest %} [revision {{version.number}}] {% endif %}
{% endblock %}