0

I am trying to create a Online exam portal and I have created one admin portal for that site. I have 2 types of users in my site "Students" and "Teachers". How can I restrict students from accessing the admin portal and other views of admin panel?

Majid Hajibaba
  • 3,105
  • 6
  • 23
  • 55

1 Answers1

0

In views.py in function related to your template, you can use the decorator permission_required as follows

from django.contrib.auth.decorators import permission_required

@permission_required('foo.access_my_view')
def my_view(request):
    ...

You have detailed instructions on how to add and modify the permissions here