#26001: Make ModelAdmin.search_fields raise data errors on __exact lookups for 
non-
string fields.
-------------------------------------+-------------------------------------
     Reporter:  Tim Graham           |                    Owner:  Saurabh
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  contrib.admin        |                  Version:  dev
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by AlexBohdan):

 Hi, can you add the possibility of disabling casting logic? After updating
 to django 5.2 I was faced with a crash when using search on different
 admin models pages.

 For example, I have an integer Filed, which is indexed in the database:

     thread_id = models.IntegerField(null=False,db_index=True,)


 I use this field in ModelAdmin `search_fields = ('thread_id__exact',)`

 Django 5.1.8 generates correct SQL which use index

     ... WHERE "reviews"."thread_id" = 1123 ...

 But django 5.2 generates incorrect SQL which doesn't use the database
 index, my search request failed with timeout and the database has an extra
 load

     ... WHERE ("reviews"."thread_id")::varchar = '1123' ...
-- 
Ticket URL: <https://code.djangoproject.com/ticket/26001#comment:24>
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 view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070196208d77e2-da1587b4-eb1a-4c5e-b751-3316a7e83e08-000000%40eu-central-1.amazonses.com.

Reply via email to