#29010: Which models is querying search_fields to autocomplete? -------------------------------------+------------------------------------- Reporter: Muslu Y. | Owner: nobody Type: New feature | Status: new Component: Database layer | Version: 2.0 (models, ORM) | Severity: Normal | Resolution: Keywords: ForeignKey, | Triage Stage: get_search_results, search_fields | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Muslu Y.):
* status: closed => new * resolution: invalid => Comment: I think Autocomplete is not enough right now. **models.py** {{{ class A(models.Model): a_name = models.CharField(max_length=100) class B(models.Model): b_name = models.ManyToManyField(A) class C(models.Model): c_name = models.ManyToManyField(A) }}} **admin.py** {{{ class AAdmin(admin.ModelAdmin): search_fields = ['a_name'] def get_search_results(self, request, queryset, search_term): queryset, use_distinct = super().get_search_results(request, queryset, search_term) ## how can i learn which models (B or C) querying for a_name? ## because i want to separately filter for every model class BAdmin(admin.ModelAdmin): autocomplete_fields = ['b_name'] class CAdmin(admin.ModelAdmin): autocomplete_fields = ['c_name'] }}} -- Ticket URL: <https://code.djangoproject.com/ticket/29010#comment:3> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/071.b35a396b821c1d45194624da328462d2%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.