#29010: Allow customizing the autocomplete search results based on the querying
model
-------------------------------------+-------------------------------------
     Reporter:  Muslu Y.             |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  contrib.admin        |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  ForeignKey,          |             Triage Stage:
  get_search_results, search_fields  |  Someday/Maybe
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by David W. Lloyd):

 Replying to [comment:8 Johannes Hoppe]:

 > > Replying to [comment:6 Johannes Hoppe]:
 >
 > > - the new autocomplete widget ignores any filtering done in the
 "limit_choices_to" ORM definition, unlike a regular select field; not very
 DRY, since limit_choices_to can, with other widgets, be used to filter
 lookups effectively... inconsistent, unintuitive behavior. If you're not
 going to fix it, perhaps update the autocomplete documentation to mention
 that limit_choices_to is completely ignored...
 >
 > I agree this is a problem. I would much welcome a fix here to. It seems
 we all missed in the reviews.
 >

 I think the problem is that any fix would almost have to do what the
 feature request here is proposing - if the view doesn't know where the
 relation is coming from, it can't consult the ORM field and get the
 correct limit_choices_to filter to apply. If the referring model were
 passed in, one way or another, this filtering could be accomplished.
 Rather than doing a view per widget, having the ModelAdmin provide its
 underlying model to any autocomplete view being referenced seems like it
 might do the trick?

 > Go ahead an decouple it. That's an easy one. You add a new method that
 by defaults calls the current soring method.
 > Please open a separate issue for that one. I would be happy to review
 this feature.
 >

 Will do, thanks!

 > It's a pretty big hypophysis that "many folks are using the admin to
 build complex interfaces", even though this is discouraged. In general I
 would kindly ask you to watch your tone. This feature is a result of a lot
 of hard work by "many folks". Phrases like "half-baked" may hurt people's
 feelings.
 >
 > You have to chose here, you either: Love it, change it or leave it.

 Understood; I'm new here and this wasn't the right tone, I apologize. I do
 love 95% of it and I hope I can help change the other five.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29010#comment:10>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.8c64cb3f080729817eedfdeb40fbcc57%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to