diff --git a/TODO b/TODO index 5e0ce91..ea7dfee 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,6 @@ * revert option * wikiword highlighting +* detect bad links * only store diffs? * anonymous edits? diff --git a/markupwiki/models.py b/markupwiki/models.py index 1fbfc70..17814c1 100644 --- a/markupwiki/models.py +++ b/markupwiki/models.py @@ -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]) diff --git a/markupwiki/templates/markupwiki/article.html b/markupwiki/templates/markupwiki/article.html index 967e81d..22ee88c 100644 --- a/markupwiki/templates/markupwiki/article.html +++ b/markupwiki/templates/markupwiki/article.html @@ -31,7 +31,7 @@

{% block article_title %} - {{article.title}} + {{article.display_title}} {% if article.is_deleted %} [deleted] {% endif %} {% if not version.is_latest %} [revision {{version.number}}] {% endif %} {% endblock %} diff --git a/markupwiki/urls.py b/markupwiki/urls.py index e289523..48cfab4 100644 --- a/markupwiki/urls.py +++ b/markupwiki/urls.py @@ -1,13 +1,13 @@ from django.conf.urls.defaults import * -WIKI_REGEX = r'^(?P[^/]+)' +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'), ) diff --git a/markupwiki/views.py b/markupwiki/views.py index 8cb9816..1d3edd6 100644 --- a/markupwiki/views.py +++ b/markupwiki/views.py @@ -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)