Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Activate the time zone after the authentication middlewares

Roland Geider51208fd1a927
diff --git a/settings/settings_global.py b/settings/settings_global.py
index 7ce4c867b..c5daf046b 100644
--- a/settings/settings_global.py
+++ b/settings/settings_global.py
@@ -155,9 +155,6 @@ MIDDLEWARE = [
# Django Admin
'django.contrib.auth.middleware.AuthenticationMiddleware',
- # Time zone middleware
- 'wger.core.middleware.TimezoneMiddleware',
-
# Auth proxy middleware
'wger.core.middleware.AuthProxyHeaderMiddleware',
@@ -167,6 +164,11 @@ MIDDLEWARE = [
# Custom authentication middleware. Creates users on-the-fly for certain paths
'wger.utils.middleware.WgerAuthenticationMiddleware',
+ # Activates the user's time zone. Has to come after the authentication
+ # middlewares: reading request.user earlier caches it and the guest user
+ # would never be created
+ 'wger.core.middleware.TimezoneMiddleware',
+
# Send an appropriate Header so search engines don't index pages
'wger.utils.middleware.RobotsExclusionMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
diff --git a/wger/core/migrations/0028_userprofile_timezone.py b/wger/core/migrations/0028_userprofile_timezone.py
index 8938cdad3..8014fc033 100644
--- a/wger/core/migrations/0028_userprofile_timezone.py
+++ b/wger/core/migrations/0028_userprofile_timezone.py
@@ -8,7 +8,7 @@ from wger.core.models.profile import validate_timezone
class Migration(migrations.Migration):
dependencies = [
- ('core', '0026_alter_userprofile_birthdate_alter_userprofile_height'),
+ ('core', '0027_powersync_publication'),
]
operations = [