sehmaschine / django-grappelli

A jazzy skin for the Django Admin-Interface (official repository).
http://www.grappelliproject.com
Other
3.77k stars 657 forks source link

Incorrect label of option returned by RelatedLookup view #1015

Closed toshka closed 1 year ago

toshka commented 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:

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.

toshka commented 1 year ago

@sehmaschine is it possible to release 3.0.6 version?

sehmaschine commented 1 year ago

@toshka waiting for a couple of replies on existing issues (and pull-requests). planning on doing the release early next week.