[Answer]-Django model mixin import dependent model

1👍

Assuming you can guarantee any class doesn’t define a related_name for the parent field, you can just do this in your create_child method:

self.childmodel_set.create()

Then there’s no need to do the import at all.

(Although I must admit I’m a bit confused about the idea of having a mixin dependent on fields in the concrete model that it’s not actually providing itself.)

Leave a comment