sehmaschine/django-grappelli — pull request #85 by fourk (2012-02-09 03:22:41+00:00)
Title: Fix bug relating to use of tuples in settings configurations used by autocomplete/related_lookup decorators

This pull request replaces: https://github.com/sehmaschine/django-grappelli/pull/84

Close whichever pull request you don't end up accepting. Copy-pasted bug documentation from my earlier pull request, changes marked with strikethrough/bold:

This fixes a typo, as well as includes a ~~warning against~~ __fix for__ using tuples for the `related_lookup_fields` and `autocomplete_lookup_fields`. This ~~warning~~ is the result of a bug I wrestled with for a while today. Here's an example of how to replicate it:

autocomplete_lookup_fields = {
'generic': (('content_type', 'object_id'),)
}

The above is output to the template for parsing via javascript as:

var autocomplete_fields_generic = [('content_type', 'object_id')];

When the expected output is:

var autocomplete_fields_generic = [['content_type', 'object_id']];