Ticket #10742: 10742_three-valued-list_select_related.diff

File 10742_three-valued-list_select_related.diff, 1.6 KB (added by mrts, 6 years ago)
  • django/contrib/admin/validation.py

     
    135135                    "callable nor a method on %s" % (cls.__name__, idx, cls.__name__))
    136136
    137137
    138     # list_select_related = False
    139138    # save_as = False
    140139    # save_on_top = False
    141     for attr in ('list_select_related', 'save_as', 'save_on_top'):
     140    for attr in ('save_as', 'save_on_top'):
    142141        if not isinstance(getattr(cls, attr), bool):
    143142            raise ImproperlyConfigured("'%s.%s' should be a boolean."
    144143                    % (cls.__name__, attr))
    145144
     145    # list_select_related = True, False, None
     146    if (not isinstance(cls.list_select_related, bool) and
     147            cls.list_select_related is not None):
     148        raise ImproperlyConfigured("'%s.list_select_related' should "
     149                "be a boolean or None." % cls.__name__)
    146150
     151
    147152    # inlines = []
    148153    if hasattr(cls, 'inlines'):
    149154        check_isseq(cls, 'inlines', cls.inlines)
  • django/contrib/admin/views/main.py

     
    200200        # with a relationship.
    201201        if self.list_select_related:
    202202            qs = qs.select_related()
     203        elif self.list_select_related is None:
     204            pass
    203205        else:
    204206            for field_name in self.list_display:
    205207                try:
Back to Top