fix post_save signal for sqlite

This commit is contained in:
smilerz
2021-12-15 13:23:22 -06:00
parent 46b83c8205
commit 0e20f679b3
4 changed files with 26 additions and 18 deletions

View File

@ -12,10 +12,7 @@ class CookbookConfig(AppConfig):
name = 'cookbook'
def ready(self):
# post_save signal is only necessary if using full-text search on postgres
if settings.DATABASES['default']['ENGINE'] in ['django.db.backends.postgresql_psycopg2',
'django.db.backends.postgresql']:
import cookbook.signals # noqa
import cookbook.signals # noqa
if not settings.DISABLE_TREE_FIX_STARTUP:
# when starting up run fix_tree to:
@ -23,7 +20,7 @@ class CookbookConfig(AppConfig):
# b) fix problems, if any, with tree consistency
with scopes_disabled():
try:
from cookbook.models import Keyword, Food
from cookbook.models import Food, Keyword
Keyword.fix_tree(fix_paths=True)
Food.fix_tree(fix_paths=True)
except OperationalError: