Closed toshka closed 1 year ago
VERSIONS: Grappelli 3.0.5, Django 4.1 STATICFILES: OK JAVASCRIPTS: OK PYTHON BUG: TRUE
RelatedLookup view returns incorrect option label ("?") if ForeignKey has limit_choices_to attribute with IN statement. Example:
RelatedLookup
"?"
ForeignKey
limit_choices_to
IN
class Category(models.Model): name = models.CharField("Title", max_length=50, unique=True) class Entry(models.Model): title = models.CharField("Title", max_length=200) category = models.ForeignKey(Category, on_delete=models.SET_NULL, related_name="entries", blank=True, null=True, limit_choices_to={"id__in": [1, 2]})
The reason is the param query_string which is quoted. It should be unquoted at RelatedLookup.get_filtered_queryset method.
query_string
RelatedLookup.get_filtered_queryset
@sehmaschine is it possible to release 3.0.6 version?
@toshka waiting for a couple of replies on existing issues (and pull-requests). planning on doing the release early next week.
VERSIONS: Grappelli 3.0.5, Django 4.1 STATICFILES: OK JAVASCRIPTS: OK PYTHON BUG: TRUE
RelatedLookup
view returns incorrect option label ("?"
) ifForeignKey
haslimit_choices_to
attribute withIN
statement. Example:The reason is the param
query_string
which is quoted. It should be unquoted atRelatedLookup.get_filtered_queryset
method.