diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-11-02 15:34:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-02 15:34:08 +0100 |
commit | dab48b7482295956973879d15bfd4d3bb0718772 (patch) | |
tree | cc662296c266edc5680e16b200d1ab4662fa98e1 /tests/migrations | |
parent | c069ee0b9dd823899bd7095deadf167cd426c0b7 (diff) | |
download | django-dab48b7482295956973879d15bfd4d3bb0718772.tar.gz |
Fixed #33234 -- Fixed autodetector crash for proxy models inheriting from non-model class.
Regression in aa4acc164d1247c0de515c959f7b09648b57dc42.
Thanks Kevin Marsh for the report.
Diffstat (limited to 'tests/migrations')
-rw-r--r-- | tests/migrations/test_autodetector.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py index 8e3382adb9..3b46601145 100644 --- a/tests/migrations/test_autodetector.py +++ b/tests/migrations/test_autodetector.py @@ -1783,6 +1783,29 @@ class AutodetectorTests(TestCase): self.assertOperationAttributes(changes, "testapp", 0, 0, name="AuthorProxy") self.assertOperationAttributes(changes, "testapp", 0, 1, name="AuthorProxy", options={}) + def test_proxy_non_model_parent(self): + class Mixin: + pass + + author_proxy_non_model_parent = ModelState( + 'testapp', + 'AuthorProxy', + [], + {'proxy': True}, + (Mixin, 'testapp.author'), + ) + changes = self.get_changes( + [self.author_empty], + [self.author_empty, author_proxy_non_model_parent], + ) + self.assertNumberMigrations(changes, 'testapp', 1) + self.assertOperationTypes(changes, 'testapp', 0, ['CreateModel']) + self.assertOperationAttributes( + changes, 'testapp', 0, 0, name='AuthorProxy', + options={'proxy': True, 'indexes': [], 'constraints': []}, + bases=(Mixin, 'testapp.author'), + ) + def test_proxy_custom_pk(self): """ #23415 - The autodetector must correctly deal with custom FK on proxy |