section_name
This commit is contained in:
parent
ec9f0a3895
commit
0a3f74eee7
@ -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])
|
||||
|
||||
|
@ -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 %}
|
||||
|
Loading…
Reference in New Issue
Block a user