Django tables2 and css

I have a table in a view that css does not display. I assume this is a stupid mistake, but I cannot find a solution in my way :(

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}) 

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.

+4
source share
1 answer

For those who have the same problem, don't forget 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") 
+7
source

Source: https://habr.com/ru/post/1502356/


All Articles