0

I want to restrict access to all url(r'^engg/', include('engg.urls')), and allow users to access them only if request.user.profile.type is 'E' . What is a simple way to do this except creating a decorator and applying it to every single view in engg/views.py ?

jck
  • 1,910
  • 4
  • 18
  • 25

1 Answers1

4

If you don't want to decorate each view separately you should use use a middleware.

Shouldn't be to hard to adapt the examples in this thread.

Community
  • 1
  • 1
arie
  • 18,737
  • 5
  • 70
  • 76