M wiki/decorators.py => wiki/decorators.py +2 -0
@@ 86,6 86,8 @@ def get_article(func=None, can_read=True, can_write=False, # noqa
article_id = kwargs.pop('article_id', None)
org = request.organization
+ if org is None:
+ return redirect('wiki:no_organization')
urlpath = None
# fetch by urlpath.path
A wiki/templates/wiki/no_organization.html => wiki/templates/wiki/no_organization.html +7 -0
@@ 0,0 1,7 @@
+{% extends "wiki/base.html" %}
+
+{% block wiki_pagetitle %}No organization found{% endblock %}
+
+{% block wiki_contents %}
+No organization have been found.
+{% endblock %}
M wiki/urls.py => wiki/urls.py +6 -0
@@ 2,6 2,8 @@
from __future__ import absolute_import, unicode_literals
from django.conf.urls import include, url
+from django.views.generic import TemplateView
+
from wiki.conf import settings
from wiki.core.plugins import registry
from wiki.core.plugins.loader import load_wiki_plugins
@@ 77,6 79,10 @@ class WikiURLPatterns(object):
url(r'^_revision/diff/(?P<revision_id>\d+)/$',
self.article_diff_view,
name='diff'),
+ url(r'^no-organization/$',
+ TemplateView.as_view(
+ template_name='wiki/no_organization.html'),
+ name='no_organization'),
]
return urlpatterns