Jolly
Jolly

Reputation: 314

Django creating syntactically wrong queries

Django is creating wrong queries, the django version is 4.2 , psycopg=2.9.9 and graphene-djangp=3.2.0

The query was working on previous version django version 3.1. I have upgraded my postgres to 12.

A snippet of the query that is created is - SELECT 1 AS "a" FROM "bug_bug" U0 "bug_bugtag" U1

Here's a snapshot of code -

authorised = user.user_posts
mandatory_label = MandatoryLabel.objects.filter(mandatory_for=MandatoryLabel.EntityType.BUG).values_list("category", flat=True)
clauses = Q()
for category in mandatory_label:
    clauses &= Q(tags__category_id=category)
return authorised.exclude(clauses).filter(
    visibility=Bug.VISIBILITY.PUBLIC
)

Blockquote

Upvotes: 0

Views: 36

Answers (0)

Related Questions