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 Brandão Owned by: Manuel Saelices
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 Brandão 8 years ago.

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by Marinho Brandão

Attachment: 8398.diff added

comment:1 Changed 8 years ago by Jacob

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 8 years ago by Manuel Saelices

Has patch: set

comment:3 Changed 8 years ago by Manuel Saelices

Owner: changed from nobody to Manuel Saelices
Status: newassigned

comment:4 Changed 8 years ago by Manuel Saelices

@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 Ben Spaulding

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: worksforme
Status: assignedclosed

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

Milestone 1.0 deleted

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