8 lines
458 B
Python
8 lines
458 B
Python
from dal import autocomplete
|
|
|
|
class LoginRequiredAjaxMixin(object):
|
|
def dispatch(self, request, *args, **kwargs):
|
|
#if request.is_ajax() and not request.user.is_authenticated: # Pokud to otevřu jako stránku, tak se omezení neuplatní, takže to asi nechceme
|
|
if not request.user.is_authenticated:
|
|
return JsonResponse(data={'results': [], 'pagination': {}}, status=401)
|
|
return super(LoginRequiredAjaxMixin, self).dispatch(request, *args, **kwargs)
|