add display title property
This commit is contained in:
parent
c933db50ae
commit
ee6effee91
1
TODO
1
TODO
@ -1,5 +1,6 @@
|
|||||||
* revert option
|
* revert option
|
||||||
* wikiword highlighting
|
* wikiword highlighting
|
||||||
|
* detect bad links
|
||||||
* only store diffs?
|
* only store diffs?
|
||||||
* anonymous edits?
|
* anonymous edits?
|
||||||
|
|
||||||
|
@ -33,6 +33,10 @@ class Article(models.Model):
|
|||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
|
@property
|
||||||
|
def display_title(self):
|
||||||
|
return self.title.rsplit('/',1)[-1].replace('_', ' ')
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('view_article', args=[self.title])
|
return reverse('view_article', args=[self.title])
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
<h2 class="article_title">
|
<h2 class="article_title">
|
||||||
{% block article_title %}
|
{% block article_title %}
|
||||||
{{article.title}}
|
{{article.display_title}}
|
||||||
{% if article.is_deleted %} [deleted] {% endif %}
|
{% if article.is_deleted %} [deleted] {% endif %}
|
||||||
{% if not version.is_latest %} [revision {{version.number}}] {% endif %}
|
{% if not version.is_latest %} [revision {{version.number}}] {% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
from django.conf.urls.defaults import *
|
from django.conf.urls.defaults import *
|
||||||
|
|
||||||
WIKI_REGEX = r'^(?P<title>[^/]+)'
|
WIKI_REGEX = r'^(?P<title>.+)'
|
||||||
|
|
||||||
urlpatterns = patterns('markupwiki.views',
|
urlpatterns = patterns('markupwiki.views',
|
||||||
url(WIKI_REGEX + '/$', 'view_article', name='view_article'),
|
|
||||||
url(WIKI_REGEX + '/edit/$', 'edit_article', name='edit_article'),
|
url(WIKI_REGEX + '/edit/$', 'edit_article', name='edit_article'),
|
||||||
url(WIKI_REGEX + '/update_status/$', 'article_status', name='update_article_status'),
|
url(WIKI_REGEX + '/update_status/$', 'article_status', name='update_article_status'),
|
||||||
url(WIKI_REGEX + '/rename_article/$', 'rename', name='rename_article'),
|
url(WIKI_REGEX + '/rename_article/$', 'rename', name='rename_article'),
|
||||||
url(WIKI_REGEX + '/history/$', 'article_history', name='article_history'),
|
url(WIKI_REGEX + '/history/$', 'article_history', name='article_history'),
|
||||||
url(WIKI_REGEX + '/history/(?P<n>\d+)/$', 'view_article', name='article_version'),
|
url(WIKI_REGEX + '/history/(?P<n>\d+)/$', 'view_article', name='article_version'),
|
||||||
url(WIKI_REGEX + '/diff/$', 'article_diff', name='article_diff'),
|
url(WIKI_REGEX + '/diff/$', 'article_diff', name='article_diff'),
|
||||||
|
url(WIKI_REGEX + '/$', 'view_article', name='view_article'),
|
||||||
)
|
)
|
||||||
|
@ -50,9 +50,6 @@ def view_article(request, title, n=None):
|
|||||||
version = article.versions.latest()
|
version = article.versions.latest()
|
||||||
version.is_latest = True
|
version.is_latest = True
|
||||||
|
|
||||||
# change article for display
|
|
||||||
article.title = article.title.replace('_', ' ')
|
|
||||||
|
|
||||||
# set editable flag on article
|
# set editable flag on article
|
||||||
article.editable = article.is_editable_by_user(request.user)
|
article.editable = article.is_editable_by_user(request.user)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user