You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and it returned nothing but in the sql it's using the enum directly in the WHERE clause (i.e. DocumentsDocumentDocumentTypeChoices.WORKSHEET) rather than a string.
{
"data": {
"documents": {
"edges": []
},
"_debug": {
"sql": [
{
"sql": "SELECT COUNT(*) AS \"__count\" FROM \"documents_document\" WHERE \"documents_document\".\"document_type\"::text LIKE 'DocumentsDocumentDocumentTypeChoices.WORKSHEET%'",
"duration": 0.003654956817626953
}
]
}
}
}
What is the expected behavior?
It should use the value of the TextChoices field in the sql for filtering (e.g. "worksheet" in my example)
I have been trying to get the filter works but have not been able to, I think I found a bug, here's what I have:
models.py
schema.py
Here's my query
it returns all the documents without filtering (see there's no WHERE clause in the returned sql)
If I use "startswith" in the query:
and it returned nothing but in the sql it's using the enum directly in the WHERE clause (i.e.
DocumentsDocumentDocumentTypeChoices.WORKSHEET
) rather than a string.It should use the value of the TextChoices field in the sql for filtering (e.g. "worksheet" in my example)
Python 3.12
Django==5.1.4
graphene-django==3.2.2
django-filter==24.3
djangorestframework==3.15.2
If I set
"DJANGO_CHOICE_FIELD_ENUM_CONVERT": False
in my settings.py then the filter works but I prefer to work with Enum.The text was updated successfully, but these errors were encountered: