Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#8398 closed (worksforme)

Admin lists aren't showing non-field columns in table header

Reported by: marinho Owned by: msaelices
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


When declared a method in list_display attribute of a ModelAdmin class, this column header (TH) is shown in result list of change_list_result.html with an error and this make it hidden, as follows:

<th&lt;font color=&#39;red&#39;&gt;header.class_attrib&lt;/font&gt;>

this line must have an {% if %} consistence around header.class_attrib:

{% for header in result_headers %}<th{{ header.class_attrib }}>

Attachments (1)

8398.diff (681 bytes) - added by marinho 8 years ago.

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by marinho

comment:1 Changed 8 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 8 years ago by msaelices

  • Has patch set

comment:3 Changed 8 years ago by msaelices

  • Owner changed from nobody to msaelices
  • Status changed from new to assigned

comment:4 Changed 8 years ago by msaelices

@marinho, I can't reproduce the error. All works fine. Can you give me both and, please?

I've used this and

from django.db import models

class Person(models.Model):
    name = models.CharField(max_length=128)

class PersonAdmin(admin.ModelAdmin):
    list_display = ('upper_case_name',)

    def upper_case_name(self, obj):
      return, PersonAdmin)

comment:5 Changed 8 years ago by benspaulding

I cannot reproduce the error either.

There should be no error because of the way invalid variables are handled. An if statement is unnecessary.

comment:6 Changed 8 years ago by jacob

  • Resolution set to worksforme
  • Status changed from assigned to closed

comment:7 Changed 8 years ago by kikko

I just had a similar problem and pinpointed the cause to TEMPLATE_STRING_IF_INVALID. So if you're experiencing a similar problem you should check whether you have TEMPLATE_STRING_IF_INVALID set in your (Not a bug since the docs warn that the admin interface expects the setting to be left alone)

comment:8 Changed 5 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top