Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

from django.contrib.auth.decorators import user_passes_test 

 

 

def anonymous_required(redirect_url='common:home'): 

""" 

Decorator for views that checks that the user is not logged in, redirecting 

to the home page if it's logged in. 

""" 

actual_decorator = user_passes_test( 

lambda u: u.is_anonymous, 

login_url=redirect_url, 

redirect_field_name=None 

) 

 

return actual_decorator