Re: Fixtures: core.serializers.sort_dependencies sorts models in the wrong order for FK constraints

2018-05-06 Thread Mike Dewhirst
On 7/05/2018 4:48 AM, Andrew Wrigley wrote: Hi Mike, thanks for the reply. My understanding is --natural-X only works if `natural_key`, `get_by_natural_key` are manually implemented on the models. I think the process should work without doing that, but I'm not sure why django orders the models

Re: Fixtures: core.serializers.sort_dependencies sorts models in the wrong order for FK constraints

2018-05-06 Thread Andrew Wrigley
Hi Mike, thanks for the reply. My understanding is --natural-X only works if `natural_key`, `get_by_natural_key` are manually implemented on the models. I think the process should work without doing that, but I'm not sure why django orders the models in such a way that they can't be deserialise

Re: Fixtures: core.serializers.sort_dependencies sorts models in the wrong order for FK constraints

2018-05-05 Thread Mike Dewhirst
On 5/05/2018 1:19 AM, Andrew Wrigley wrote: Hi all, I'm trying to dump a database fixture, and load it again to run tests. When I run `python manage.py test`, I get: You need to --exclude all models with data not used in any tests. Considering that tests should be run with known data, if

Fixtures: core.serializers.sort_dependencies sorts models in the wrong order for FK constraints

2018-05-04 Thread Andrew Wrigley
Hi all, I'm trying to dump a database fixture, and load it again to run tests. When I run `python manage.py test`, I get: > IntegrityError: Problem installing fixtures: insert or update on table > "publisher_journaldupextid" violates foreign key constraint > "publisher_journaldup_journa