Skip to main content

Home/ interesting_sites/ Group items tagged authentication

Rss Feed Group items tagged

pagetribe .

Chapter 8: Advanced Views and URLconfs - 0 views

  • Here, each view starts by checking that request.user is authenticated — that is, the current user has successfully logged into the site — and redirects to /accounts/login/ if not.
  • It would be nice if we could remove that bit of repetitive code from each of these views and just mark them as requiring authentication.
  • Now, we can remove the if not request.user.is_authenticated() checks from our views and simply wrap them with requires_login in our URLconf:
  • ...3 more annotations...
  • This has the same effect as before, but with less code redundancy. Now we’ve created a nice, generic function — requires_login() that we can wrap around any view in order to make it require login.
  • making a view wrapper.
  • There’s an important gotcha here: the regular expressions in this example that point to an include() do not have a $ (end-of-string match character) but do include a trailing slash.
  •  
    Here, each view starts by checking that request.user is authenticated - that is, the current user has successfully logged into the site - and redirects to /accounts/login/ if not.
pagetribe .

About this site - News Mixer - 0 views

  • Developers News Mixer is free and open source software, coded in Python with the Django Web development framework, and uses Facebook Connect for authentication. You can read more about our development process in our report, and find our source at Google Code.
  •  
    Developers News Mixer is free and open source software, coded in Python with the Django Web development framework, and uses Facebook Connect for authentication. You can read more about our development process in our report, and find our source at Google Code.
1 - 3 of 3
Showing 20 items per page