Django admin and column width via list_display

I read in Django> = 1.6 docs:

"The field names in list_display will also appear as CSS classes in the HTML output as a column per element. This can be used to set the column widths in the CSS file.

OK. But how?

class bollaAdmin(admin.ModelAdmin):
  ordering = ['num']
  list_display = ('num|width=15', 'Vendemmia','Cultivar', 'Provenienza' , 'netto', 'grado','montegradi')

      

+3


source to share


1 answer


Here is an HTML snippet for a column containing an attribute headline

from one of my admins:

<th scope="col" class="sortable column-headline">
   <div class="text"><a href="?o=2.4.-5">Headline</a></div>
   <div class="clear"></div>
</th>

      



You can set the width of this in CSS like this:

th.column-headline {
  width: 10000000px;
}

      

+3


source







All Articles