Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child can't Many To Many Parent #535

Open
AstraLuma opened this issue Dec 20, 2022 · 2 comments
Open

Child can't Many To Many Parent #535

AstraLuma opened this issue Dec 20, 2022 · 2 comments

Comments

@AstraLuma
Copy link

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'.
@AdamDonna
Copy link
Contributor

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?

@AstraLuma
Copy link
Author

I honestly don't remember what I was trying to do at the time. Does this kind of self-reference work now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants