Created
December 27, 2013 18:20
-
-
Save victorono/8150665 to your computer and use it in GitHub Desktop.
Check if activated account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
active_required = user_passes_test(lambda u: u.is_active, | |
login_url='login.views.not_active', | |
redirect_field_name='redirect_to' | |
) | |
def active_and_login_required(view_func): | |
decorated_view_func = login_required( | |
active_required(view_func), | |
redirect_field_name='redirect_to', | |
login_url='login.views.sign_in' | |
) | |
return decorated_view_func |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment