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

[BUG] prefetch_related not working with m2m fields (forward relationship) #189

Open
ht-deepa opened this issue Oct 2, 2018 · 0 comments

Comments

@ht-deepa
Copy link

ht-deepa commented Oct 2, 2018

prefetch_related raising this exception at djongo/sql2mongo/converters.py -- ValueError: invalid literal for int() with base 10: '"article_article_tags"."article_id"'

Article Model
from django.db import models
class Article(models.Model) :
....
tags = models.ManyToManyField(Tag)
.......

Article.objects.prefetch_related('tags').all()

Traceback

djongo.sql2mongo.SQLDecodeError: FAILED SQL: SELECT ("article_article_tags"."article_id") AS "_prefetch_related_val_article_id", "common_tag"."id", "common_tag"."modify_date", "common_tag"."created_date", "common_tag"."name", "common_tag"."description" FROM "common_tag" INNER JOIN "article_article_tags" ON ("common_tag"."id" = "article_article_tags"."tag_id") WHERE "article_article_tags"."article_id" IN (%(0)s)

tony13tv added a commit to tony13tv/djongo that referenced this issue Feb 27, 2021
nesdis pushed a commit that referenced this issue Mar 25, 2021
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

1 participant