I would like to know how to serve files only to staff users (that is only when is_staff=True).
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you mean dynamic content generated by Django, read on. Else, for static files, go with the http server config solution described in the other answer.
You can set a fine-grained control at the view level using a decorator:
More info at http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.decorators.user_passes_test
If you want to make a generalised use of this you may do:
…and include this in your url configuration:
…etc.