Show error message if not allowed to access admin page.

This commit is contained in:
2018-12-29 17:18:54 +02:00
parent 8eca3dc7a9
commit 05ecb6a493
2 changed files with 9 additions and 7 deletions

View File

@ -4,8 +4,16 @@
{% block body %}
<div class="container">
<h1>Admin settings</h1>
{% crispy form %}
{% if not request.user.is_authenticated or not request.user.is_superuser %}
<div class="alert alert-danger" role="alert">
You must be an administrator to access this page!
</div>
{% else %}
{% crispy form %}
{% endif %}
</div>
{% endblock body %}