Closed mrmachine closed 4 years ago
Repository health increased by 2% when pulling 428a933 on ixc:ixc/fix-for-polymorphic-models into f5f7207 on paulocheque:master.
The failing tests are Django 1.2 and 1.3, which need an earlier version of django-polymorphic
. I started fixing the tests, but eventually submitted #60 instead which simplifies the tox.ini
using generative envlist and conditional factors, drops Django 1.2 and 1.3 which are no longer supported, and adds some versions of Python that are supported (according to release notes) of current Django releases.
If Django 1.2 and 1.3 support is still desired, just move the django-polymorphic
from requirements.txt
and into tox.ini
with conditional factors:
envlist =
django{12,13}-py{26,27},
django14-py{26,27},
django16-py{26,27,32,33},
django17-py{27,32,33,34}
deps =
-r{toxinidir}/requirements.txt
django12: django>=1.2,<1.3
django13: django>=1.3,<1.4
django14: django>=1.4,<1.5
django16: django>=1.6,<1.7
django17: django>=1.7,<1.8
django{12,13}: django_polymorphic<0.4.2
django{14,16,17}: django_polymorphic>=0.4.2
Repository health increased by 2% when pulling 1b15db7 on ixc:ixc/fix-for-polymorphic-models into f5f7207 on paulocheque:master.
@paulocheque any feedback on this?
@mrmachine I dont like the idea to include a dependency directly in the core of the library. Do you think it is possible to implement this flexibility in an abstract way?
Do you think it is possible to fix this using Custom Field Fixture? http://ddf.codeart.io/en/latest/data_fixtures.html#custom-field-fixture
If it is possible, maybe we can create a common_datafixture.py
to include fixtures/plugins for common libraries. In this way, the dependency will not be in the core of the DDF.
What do you think?
@mrmachine Any progress on this? Would be nice to get a release with support for django-polymorphic.
@stianpr I've just been using a fork with this fixed as above.
@paulocheque I really don't know how or if polymorphic support could be fixed with a custom field fixture. django-polymorphic
is not using any custom model fields. It has an FK to Django's ContentType
model, and it is using Django's multi-table-inheritance for the parent and child models.
Perhaps other models besides polymorphic models would also have fields that should not be touched by DDF (e.g. the _ptr
field on MTI child models), and so perhaps a generic way to tell DDF which fields to ignore for which types of models could resolve this without introducing a dependency on django-polymorphic
.
Or perhaps you could elaborate on how you think a custom field fixture might help?
@mrmachine could #67 solve this issue? I haven't really tested it but it sounds like thats the issue you address in the summary?
Closing in favor of https://github.com/paulocheque/django-dynamic-fixture/pull/112
If the model is a
PolymorphicModel
then it has apolymorphic_ctype
field which shouldn't be touched. Changing it will cause the model not to be found by its own querysets.MTI subclasses have a
OneToOneField
as their primary key, which should also not be touched.