add display title property

This commit is contained in:
James Turk 2010-04-05 13:45:05 -04:00
parent c933db50ae
commit ee6effee91
5 changed files with 8 additions and 6 deletions

1
TODO
View File

@ -1,5 +1,6 @@
* revert option
* wikiword highlighting
* detect bad links
* only store diffs?
* anonymous edits?

View File

@ -33,6 +33,10 @@ class Article(models.Model):
def __unicode__(self):
return self.title
@property
def display_title(self):
return self.title.rsplit('/',1)[-1].replace('_', ' ')
def get_absolute_url(self):
return reverse('view_article', args=[self.title])

View File

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

View File

@ -1,13 +1,13 @@
from django.conf.urls.defaults import *
WIKI_REGEX = r'^(?P<title>[^/]+)'
WIKI_REGEX = r'^(?P<title>.+)'
urlpatterns = patterns('markupwiki.views',
url(WIKI_REGEX + '/$', 'view_article', name='view_article'),
url(WIKI_REGEX + '/edit/$', 'edit_article', name='edit_article'),
url(WIKI_REGEX + '/update_status/$', 'article_status', name='update_article_status'),
url(WIKI_REGEX + '/rename_article/$', 'rename', name='rename_article'),
url(WIKI_REGEX + '/history/$', 'article_history', name='article_history'),
url(WIKI_REGEX + '/history/(?P<n>\d+)/$', 'view_article', name='article_version'),
url(WIKI_REGEX + '/diff/$', 'article_diff', name='article_diff'),
url(WIKI_REGEX + '/$', 'view_article', name='view_article'),
)

View File

@ -50,9 +50,6 @@ def view_article(request, title, n=None):
version = article.versions.latest()
version.is_latest = True
# change article for display
article.title = article.title.replace('_', ' ')
# set editable flag on article
article.editable = article.is_editable_by_user(request.user)