4

CSS をレンダリングしないビューにテーブルがあります。ばかげたエラーだと思いますが、途中で解決策が見つかりません:(

景色 :

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

テンプレート:

{% 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>

私の貧弱な英語と初心者の質問で申し訳ありません。

4

1 に答える 1

8

同じ問題を抱えている人は、属性を忘れないでください...

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")
于 2013-09-16T08:49:22.770 に答える