Revised not to log the user visits when DEBUG is on in the development environment in the Mia core application.
This commit is contained in:
parent
96e1bd2374
commit
9973fc851c
@ -23,6 +23,7 @@ import ipaddress
|
|||||||
import socket
|
import socket
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.db.models import F
|
from django.db.models import F
|
||||||
from django.db.models.functions import Now
|
from django.db.models.functions import Now
|
||||||
from django.http import HttpResponse, HttpRequest
|
from django.http import HttpResponse, HttpRequest
|
||||||
@ -76,6 +77,7 @@ def login_required(function=None):
|
|||||||
if "visit_logged" in request.session:
|
if "visit_logged" in request.session:
|
||||||
del request.session["visit_logged"]
|
del request.session["visit_logged"]
|
||||||
return HttpResponse(status=401)
|
return HttpResponse(status=401)
|
||||||
|
if not settings.DEBUG:
|
||||||
_log_visit(request)
|
_log_visit(request)
|
||||||
return view_func(request, *args, **kwargs)
|
return view_func(request, *args, **kwargs)
|
||||||
return _wrapped_view
|
return _wrapped_view
|
||||||
|
Loading…
Reference in New Issue
Block a user