mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
decorator to check if user is logged in if settings.PUBLIC_SITE
This commit is contained in:
parent
671e946c6d
commit
872ffe5882
14
helper/__init__.py
Normal file
14
helper/__init__.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
class login_required_if_public(object):
|
||||||
|
|
||||||
|
def __init__(self, f):
|
||||||
|
if settings.PUBLIC_SITE:
|
||||||
|
self.f = login_required(f)
|
||||||
|
else:
|
||||||
|
self.f = f
|
||||||
|
|
||||||
|
def __call__(self, *args, **kwargs):
|
||||||
|
return self.f(*args, **kwargs)
|
Loading…
Reference in New Issue
Block a user