Commit d956400f by benjaoming

Merge pull request #190 from yedpodtrzitko/master

missing root notification and fix #174
parents e5cbdf45 085d4aa2
......@@ -21,7 +21,8 @@
<h1>{% trans "Congratulations!" %}</h1>
<p class="lead">
{% trans "You have django-wiki installed... but there are no articles. So it's time to create the first one, the root article. In the beginning, it will only be editable by administrators, but you can define permissions after." %}
{% trans "You have django-wiki installed... but there are no articles. So it's time to create the first one, the root article." %}
{% trans "In the beginning, it will only be editable by administrators, but you can define permissions after." %}
</p>
<h2 class="page-header">{% trans "Root article" %}</h2>
......
{% extends "wiki/create_root.html" %}
{% load i18n %}
{% block wiki_contents %}
<h1>{% trans "Congratulations!" %}</h1>
<p class="lead">
{% trans "You have django-wiki installed... but there are no articles. So it's time to create the first one, the root article." %}
</p>
<p class="lead">
{% trans "In can be created and/or edited only by administrators, but you can define permissions after." %}
</p>
{% endblock %}
......@@ -55,6 +55,7 @@ class WikiURLPatterns(object):
urlpatterns = patterns('',
url('^$', self.article_view_class.as_view(), name='root', kwargs={'path': ''}),
url('^create-root/$', article.CreateRootView.as_view(), name='root_create'),
url('^missing-root/$', article.MissingRootView.as_view(), name='root_missing'),
url('^_search/$', get_class_from_str(self.search_view_class).as_view(), name='search'),
url('^_revision/diff/(?P<revision_id>\d+)/$', self.article_diff_view, name='diff'),
)
......
......@@ -720,8 +720,8 @@ class CreateRootView(FormView):
template_name = 'wiki/create_root.html'
def dispatch(self, request, *args, **kwargs):
if not request.user.is_superuser:
return redirect(settings.LOGIN_URL + "?next=" + reverse("wiki:root_create"))
if not self.request.user.is_superuser:
return redirect("wiki:root_missing")
try:
root = models.URLPath.root()
......@@ -748,3 +748,7 @@ class CreateRootView(FormView):
data = super(CreateRootView, self).get_context_data(**kwargs)
data['editor'] = editors.getEditor()
return data
class MissingRootView(TemplateView):
template_name = 'wiki/root_missing.html'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment