From 4d56d18a244a68231646de4ab02ec17fb3973104 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Fri, 3 May 2024 15:22:24 -0500 Subject: [PATCH] Import models when django ready Since we store model's instances in cache, this will help django figure out the correct model when unserializing cache data. --- chat_box/apps.py | 3 +++ judge/apps.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/chat_box/apps.py b/chat_box/apps.py index dd90bc1..e49c8ad 100644 --- a/chat_box/apps.py +++ b/chat_box/apps.py @@ -3,3 +3,6 @@ from django.apps import AppConfig class ChatBoxConfig(AppConfig): name = "chat_box" + + def ready(self): + from . import models diff --git a/judge/apps.py b/judge/apps.py index f223d52..4df4c5a 100644 --- a/judge/apps.py +++ b/judge/apps.py @@ -12,7 +12,7 @@ class JudgeAppConfig(AppConfig): # OPERATIONS MAY HAVE SIDE EFFECTS. # DO NOT REMOVE THINKING THE IMPORT IS UNUSED. # noinspection PyUnresolvedReferences - from . import signals, jinja2 # noqa: F401, imported for side effects + from . import models, signals, jinja2 # noqa: F401, imported for side effects from django.contrib.flatpages.models import FlatPage from django.contrib.flatpages.admin import FlatPageAdmin