Django

Code

Changeset 3794

Show
Ignore:
Timestamp:
09/22/06 08:10:46 (2 years ago)
Author:
mtredinnick
Message:

Fixed #2520 -- Fixed a problem with invalid SQL being generated by admin
interface in certain circumstances. Patch from favo@exoweb.net.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r3786 r3794  
    7373    Andy Dustman <farcepest@gmail.com> 
    7474    Clint Ecker 
     75    favo@exoweb.net 
    7576    gandalf@owca.info 
    7677    Baishampayan Ghose 
  • django/trunk/django/contrib/admin/views/main.py

    r3613 r3794  
    728728                or_queries = [models.Q(**{construct_search(field_name): bit}) for field_name in self.lookup_opts.admin.search_fields] 
    729729                other_qs = QuerySet(self.model) 
     730                if qs._select_related: 
     731                    other_qs = other_qs.select_related() 
    730732                other_qs = other_qs.filter(reduce(operator.or_, or_queries)) 
    731733                qs = qs & other_qs