From 0a3f74eee7ea42b0055162fb614b4dd9c85cc0b8 Mon Sep 17 00:00:00 2001 From: James Turk Date: Mon, 5 Apr 2010 14:23:26 -0400 Subject: [PATCH] section_name --- markupwiki/models.py | 5 +++++ markupwiki/templates/markupwiki/article.html | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/markupwiki/models.py b/markupwiki/models.py index 17814c1..a99bd11 100644 --- a/markupwiki/models.py +++ b/markupwiki/models.py @@ -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]) diff --git a/markupwiki/templates/markupwiki/article.html b/markupwiki/templates/markupwiki/article.html index 22ee88c..307cb42 100644 --- a/markupwiki/templates/markupwiki/article.html +++ b/markupwiki/templates/markupwiki/article.html @@ -31,7 +31,9 @@

{% block article_title %} - {{article.display_title}} +{% if article.section_name %}{{article.section_name}} / {% endif %} +{{article.display_title}} + {% if article.is_deleted %} [deleted] {% endif %} {% if not version.is_latest %} [revision {{version.number}}] {% endif %} {% endblock %}