-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a column named label
#349
a column named label
#349
Comments
I've found a way to change this : _label = tables.TemplateColumn(template_code="{{ record.label }}", verbose_name=_("label")) Its a work-arround, but it works... |
By default, columns get their name as css-class, this is expected behaviour. I think you could change your example to If I were to design this from scratch, I probably would not add this without a prefix as default behaviour, but it is what we have now. We might change it at some point to try to remove the element of suprise. |
I was also unpleasantly surprised by this, and while the workaround above does work, it feels pretty kludgy. I looked for some way to override the default class attribute, but found nothing -- I could only append additional classes. |
I was also irritated by this at first. When there are cases when I want to style a certain column, it will usually be based on the kind of data, not the field name. So I will rather have a reusable We could think about removing these unprefixed classes in a 2.0 as a breaking change, but I'm not sure if that's worth it. Even if, there needs to be an easy migration path without changing every single column in every table. |
Reopened, we should be able to have a nice upgrade path:
Anybody able/willing to implement this and open a PR? |
For reference, the offending code is here: https://github.com/bradleyayers/django-tables2/blob/03cb7c5f6f1c98801bb7129c9a9e3d596c1a5b12/django_tables2/columns/base.py#L305-L307 @jieter what method of override would you suggest? Could Column have a I could look into implementing this some time in August. |
@graup any progress? |
@jieter Not yet. I might find some time next week or the week after that. |
Hi,
I've a column based on a model attribute named 'label', but this CSS class exists in bootstrap !
When the table in rendered, I can see a weird rendering : a
label
css class is added to the th and th cells, making display failing : bootstrap.css defines it's ownlabel
css class, which is confusing...I've tried to update the Colums attrs through :
but the class
label
is still displayed. How can I change this ?Thanks !
The text was updated successfully, but these errors were encountered: