Nathan Ostgard has a simple-but-sweet middleware to reverse Django’s usual authentication requirements. Most publishing-type sites are public-facing and have only a few pages that require authentication. Django makes that easy by providing a simple decorator for requiring a user to log in to view a page. But, if you want the opposite — a site that requires authentication, except for a few public-facing pages — well, that’s a more tedious task with Django’s built-in mechanisms. This little middleware changes all that. It gives you a site that requires a user to log in, but a simple decorator to exempt a few pages from that requirement. Nice.

Visit site:

http://nathanostgard.com/archives/2007/7/22/private-by-default/

Comments

No one has posted any comments on this entry as of yet. Perhaps you’d like to be the first?

Post your comment