This commit is contained in:
jonaswinkler 2021-03-14 14:17:21 +01:00
parent c74d261f6a
commit 0ad2b05455

View File

@ -1,4 +1,5 @@
from django.conf import settings from django.conf import settings
from django.contrib import auth
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.utils.deprecation import MiddlewareMixin from django.utils.deprecation import MiddlewareMixin
from rest_framework import authentication from rest_framework import authentication
@ -11,6 +12,7 @@ class AutoLoginMiddleware(MiddlewareMixin):
try: try:
request.user = User.objects.get( request.user = User.objects.get(
username=settings.AUTO_LOGIN_USERNAME) username=settings.AUTO_LOGIN_USERNAME)
auth.login(request, request.user)
except User.DoesNotExist: except User.DoesNotExist:
pass pass