Ticket #9654: respect-empty-list_display_links.diff

File respect-empty-list_display_links.diff, 1.9 KB (added by mdh, 16 years ago)
  • django/contrib/admin/validation.py

     
    4242                                % (cls.__name__, idx, field))
    4343
    4444    # list_display_links
    45     if hasattr(cls, 'list_display_links'):
     45    if hasattr(cls, 'list_display_links') and cls.list_display_links is not None:
    4646        check_isseq(cls, 'list_display_links', cls.list_display_links)
    4747        for idx, field in enumerate(cls.list_display_links):
    4848            fetch_attr(cls, model, opts, 'list_display_links[%d]' % idx, field)
  • django/contrib/admin/options.py

     
    156156    __metaclass__ = forms.MediaDefiningClass
    157157
    158158    list_display = ('__str__',)
    159     list_display_links = ()
     159    list_display_links = None
    160160    list_filter = ()
    161161    list_select_related = False
    162162    list_per_page = 100
  • django/contrib/admin/templatetags/admin_list.py

     
    212212        if force_unicode(result_repr) == '':
    213213            result_repr = mark_safe(' ')
    214214        # If list_display_links not defined, add the link tag to the first field
    215         if (first and not cl.list_display_links) or field_name in cl.list_display_links:
     215        if (first and cl.list_display_links is None) or (cl.list_display_links and field_name in cl.list_display_links):
    216216            table_tag = {True:'th', False:'td'}[first]
    217217            first = False
    218218            url = cl.url_for_result(result)
Back to Top