Skip to content

Commit

Permalink
Utilise la table django_session au lieu de utils_customsession
Browse files Browse the repository at this point in the history
Le changement dans les sessions introduit par
2b2215e (PR zestedesavoir#6021) utilise une nouvelle
table utils_customsession pour stocker les sessions, tout en conservant
la table django_session.
  • Loading branch information
philippemilink committed Aug 25, 2024
1 parent 23c78ec commit 8f97b3f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions zds/utils/custom_cached_db_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class CustomSession(AbstractBaseSession):
def get_session_store_class(cls):
return SessionStore

class Meta(AbstractBaseSession.Meta):
# Use the same name as default Django session table, to prevent having
# two tables to store sessions, but only one actually used.
db_table = "django_session"


class SessionStore(DBStore):
"""Custom session store for the custom session model."""
Expand Down
18 changes: 18 additions & 0 deletions zds/utils/migrations/0027_rename_session_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.11 on 2024-08-25 20:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("utils", "0026_customsession"),
]

operations = [
migrations.RunSQL("DROP TABLE IF EXISTS django_session"),
migrations.AlterModelTable(
name="customsession",
table="django_session",
),
]

0 comments on commit 8f97b3f

Please sign in to comment.