Merge branch 'pr-fix-models-not-ready-warning'

This commit is contained in:
Brent O'Connor 2019-06-26 13:12:58 -05:00
commit 03d9ee4ad7
2 changed files with 11 additions and 16 deletions

View file

@ -21,16 +21,3 @@ __version__ = get_version()
default_app_config = 'categories.apps.CategoriesConfig'
def register():
from categories import settings
from categories.registration import (_process_registry, registry)
_process_registry(settings.FK_REGISTRY, registry.register_fk)
_process_registry(settings.M2M_REGISTRY, registry.register_m2m)
try:
register()
except Exception as e:
print(e)

View file

@ -1,20 +1,28 @@
# -*- coding: utf-8 -*-
from unittest import skip
from django.core import management
from django.core.management.base import CommandError
from django.db import connection
from django.test import TestCase
class TestMgmtCommands(TestCase):
@classmethod
def setUpClass(cls):
connection.disable_constraint_checking()
super(TestMgmtCommands, cls).setUpClass()
@classmethod
def tearDownClass(cls):
super(TestMgmtCommands, cls).tearDownClass()
connection.enable_constraint_checking()
def test_add_category_fields(self):
management.call_command('add_category_fields', verbosity=0)
def test_add_category_fields_app(self):
management.call_command('add_category_fields', 'flatpages', verbosity=0)
@skip("Breaks with Django > 2. Skipping until it can be fixed.")
def test_drop_category_field(self):
management.call_command('drop_category_field', 'flatpages', 'flatpage', 'category', verbosity=0)