I've got a table in a view which doesn't render css. I suppose it's a stupid error but I can't find any solution on my way :(
The View :
class ContactsTable(tables.Table):
selection = tables.CheckBoxColumn(accessor="id")
class Meta:
model = Contact
exclude = ("id", "civilite", "ad1", "ad2", "cp")
sequence =("selection", "nom", "prenom", "comments", "telport", "telfixe", "email", "ville", "regime")
def ListContacts(request):
table = ContactsTable(Contact.objects.all())
RequestConfig(request).configure(table)
return render(request, "contacts/contact_list.html", {'table': table})
The Template :
{% load render_table from django_tables2 %}
<html>
<head>
<link rel="stylesheet" href="{{ STATIC_URL }}django_tables2/themes/paleblue/css/screen.css" />
</head>
<body>
{% render_table table %}
</body>
</html>
Sorry for my poor english and noobie question.
For anyone who has the same problem, don't forget the attrs...
class ContactsTable(tables.Table):
class Meta:
model = Contact
exclude = ("id", "civilite", "ad1", "ad2", "cp")
sequence =("selection", "nom", "prenom", "comments", "telport", "telfixe", "email", "ville", "regime")
--> attrs = {"class": "paleblue"} <--
selection = tables.CheckBoxColumn(accessor="id")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With