Reputation: 219
I want to make a column wider in the Django Admin change_list.
I've read this link, which references
"The field names in list_display will also appear as CSS classes in the HTML output, in the form of column- on each element. This can be used to set column widths in a CSS file."
I have a column named "project."
I added this
th.column-project{width:50%}
to the end of an existing css file.
Nothing happened. What am I doing wrong?
Here is the css path
#result_list > thead > tr > th.sortable.column-project
and some of the actual HTML
<div class="grp-module grp-changelist-results">
<table id="result_list" cellspacing="0" class="grp-sortable">
<thead>
<tr>
<th scope="col" class="sortable column-project">
<div class="grp-text"><a href="?o=4.2">Project</a></div>
</th>
</tr>
</thead>
Upvotes: 0
Views: 531
Reputation: 1391
The answer is somewhat listed in the comments above. For future readers of this QA:
The OP has used the grp-text class to style the column. This suggest the presence of Grappelli as skin over the admin. When you aren't using Grappelli, the class name would be .text.
Overriding the grp-text does not seem to be right because this could mess with other elements that are present in your TH. but for now you've got a solution.
Upvotes: 1
Reputation: 219
Thanks to some help from Wouter above, I realized that I needed to call out the specific class.
th.sortable.column-project .grp-text {width:50%}.
Upvotes: 0