my code
view.py
def home(request):
return render(request, 'university_home.html')
i want to allow some users to visit this. what are the steps to create a user permission and to assign it from admin panel.
my code
view.py
def home(request):
return render(request, 'university_home.html')
i want to allow some users to visit this. what are the steps to create a user permission and to assign it from admin panel.
See the docs at Using the Django authentication system | Django documentation | Django and the MDN Tutorial at Django Tutorial Part 8: User authentication and permissions - Learn web development | MDN
My view is not having any Model context to render in it.
That doesn’t fundamentally change how you control access to views.
i am confused.
source code : immodded/univManage (github.com)
home view of university app has to be delevired only to university admins. i have created auth group in admin panel and assign neccessary permissions and added users to it. i alse create a home view for delivering the link to all staff and departments. this home has to be view only to the users i added in university admin group.
Yes, and the process for how to do that is documented in the links provided above.
the permissions assigned are based or act on models e.g. app.edit_model.
but the view on which i need permission is not having any model dependency
That is not an accurate statement.
Permissions are defined relative to a model. How they are used is entirely up to you, and not restricted to the models involved.
See the full discussion at Conditional content rendering, based on permissions