Login

Set test cookie unless logged in

Author:
nipuL
Posted:
April 4, 2008
Language:
Python
Version:
.96
Score:
1 (after 1 ratings)

This allows you to use a quick login forms outside of the django.contrib.auth.views.login view, the cookie will be deleted once you login.

1
2
3
4
class SetTestCookieMiddleware(object):
	def process_request(self, request):
		if not request.user.is_authenticated():
			request.session.set_test_cookie()

More like this

  1. Month / Year SelectDateWidget based on django SelectDateWidget by pierreben 3 months ago
  2. Python Django CRUD Example Tutorial by tuts_station 3 months, 2 weeks ago
  3. Browser-native date input field by kytta 5 months ago
  4. Generate and render HTML Table by LLyaudet 5 months, 1 week ago
  5. My firs Snippets by GutemaG 5 months, 1 week ago

Comments

Please login first before commenting.