anc1revv
anc1revv

Reputation: 1613

Make certain pages only available to certain users in django?

I'm building an ecommerce site with django. I want to build a page that lists out all the orders created on a certain day, but i only want my staff to be able to have access to this page. How can i do this?

Upvotes: 2

Views: 141

Answers (1)

FastRipeFastRotten
FastRipeFastRotten

Reputation: 1275

If by staff, you mean the is_staff flag and not a custom group, then you can use this decorator before your view

from django.contrib.admin.views.decorators import staff_member_required

@staff_member_required
... view ...

Upvotes: 2

Related Questions