Dashboard access permission updated

This commit is contained in:
Adil Mohammed 2023-05-14 16:49:58 +03:00
parent 43f1cb9647
commit a4d4ac284b
2 changed files with 5 additions and 2 deletions

View File

@ -3,7 +3,7 @@ from django.contrib import messages
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.conf import settings from django.conf import settings
from accounts.decorators import lecturer_required from accounts.decorators import admin_required, lecturer_required
from .forms import SessionForm, SemesterForm, NewsAndEventsForm from .forms import SessionForm, SemesterForm, NewsAndEventsForm
from .models import * from .models import *
@ -284,6 +284,7 @@ def semester_delete_view(request, pk):
# return response # return response
@login_required
@admin_required
def dashboard_view(request): def dashboard_view(request):
return render(request, 'app/dashboard.html') return render(request, 'app/dashboard.html')

View File

@ -32,9 +32,11 @@
{% url 'quiz_progress' as qpr %} {% url 'quiz_marking' as qce %} {% url 'user_course_list' as ucl %} {% url 'quiz_progress' as qpr %} {% url 'quiz_marking' as qce %} {% url 'user_course_list' as ucl %}
{% url 'admin_panel' as admin_p %} {% url 'admin_panel' as admin_p %}
<ul> <ul>
{% if request.user.is_superuser %}
<li class="{% if request.path == dash %}active{% endif %}"> <li class="{% if request.path == dash %}active{% endif %}">
<a href="{% url 'dashboard' %}"><i class="fas fa-tachometer-alt"></i>Dashboard</a> <a href="{% url 'dashboard' %}"><i class="fas fa-tachometer-alt"></i>Dashboard</a>
</li> </li>
{% endif %}
<li class="{% if request.path == hom %}active{% endif %}"> <li class="{% if request.path == hom %}active{% endif %}">
<a href="{% url 'home' %}"><i class="fas fa-home"></i>Home</a> <a href="{% url 'home' %}"><i class="fas fa-home"></i>Home</a>
</li> </li>