Commit e4e655ed by yed_

show info about missing root instead of redirect to login (fix #174)

parent 05a5f536
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
<h1>{% trans "Congratulations!" %}</h1> <h1>{% trans "Congratulations!" %}</h1>
<p class="lead"> <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> </p>
<h2 class="page-header">{% trans "Root article" %}</h2> <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): ...@@ -55,6 +55,7 @@ class WikiURLPatterns(object):
urlpatterns = patterns('', urlpatterns = patterns('',
url('^$', self.article_view_class.as_view(), name='root', kwargs={'path': ''}), url('^$', self.article_view_class.as_view(), name='root', kwargs={'path': ''}),
url('^create-root/$', article.CreateRootView.as_view(), name='root_create'), 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('^_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'), url('^_revision/diff/(?P<revision_id>\d+)/$', self.article_diff_view, name='diff'),
) )
......
...@@ -720,8 +720,8 @@ class CreateRootView(FormView): ...@@ -720,8 +720,8 @@ class CreateRootView(FormView):
template_name = 'wiki/create_root.html' template_name = 'wiki/create_root.html'
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
if not request.user.is_superuser: if not self.request.user.is_superuser:
return redirect(settings.LOGIN_URL + "?next=" + reverse("wiki:root_create")) return redirect("wiki:root_missing")
try: try:
root = models.URLPath.root() root = models.URLPath.root()
...@@ -748,3 +748,7 @@ class CreateRootView(FormView): ...@@ -748,3 +748,7 @@ class CreateRootView(FormView):
data = super(CreateRootView, self).get_context_data(**kwargs) data = super(CreateRootView, self).get_context_data(**kwargs)
data['editor'] = editors.getEditor() data['editor'] = editors.getEditor()
return data 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