django-polymorphic
django-polymorphic copied to clipboard
Child can't Many To Many Parent
class Parent(PolymorphicModel):
...
class Child(Parent):
spam = models.ManyToManyField(Parent)
$ ./manage.py makemigrations
SystemCheckError: System check identified some issues:
ERRORS:
myapp.Child.spam: (fields.E305) Reverse query name for 'myapp.Child.spam' clashes with reverse query name for 'myapp.Child.parent_ptr'.
HINT: Add or change a related_name argument to the definition for 'myapp.Child.spam' or 'myapp.Child.parent_ptr'.
I'm pretty sure this isn't an issue that's specific to django-polymorphic https://docs.djangoproject.com/en/4.2/ref/models/fields/#django.db.models.ForeignKey.related_query_name
Does this fix your issue? Could this issue be closed?
I honestly don't remember what I was trying to do at the time. Does this kind of self-reference work now?