저는 장고를 처음 사용했습니다.django_tables2를 사용하여 django의 테이블에 CSS 스타일 추가
{% render_table table %}
을 실행할 때 CSS 스타일을 테이블에 추가하려고합니다.
views.py :
def myTable(request):
table = myDataTable.objects.all()
filter = request.GET.get('q')
startDate = request.GET.get('sd')
endDate = request.GET.get('ed')
if mail:
table = table.filter(Q(filter__icontains=filter) &
Q(evaluation_date__range=[startDate, endDate])).distinct()
else:
table = table.filter(Q(evaluation_date__range=[startDate, endDate])).distinct()
table = TableView(table)
RequestConfig(request).configure(table)
return render(request, 'myapp/myTable.html', {'table': table})
tables.py :
class TableView(tables.Table):
class Meta:
model = myDataTable
template = 'django_tables2/bootstrap.html'
myApp.html
{% load staticfiles %}
{% load render_table from django_tables2 %}
....
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
....
<body>
{% render_table table %}
project/static/css/
에서 내가 가진
코드는 다음과 같이 보인다 관례 타일 파일 customstyle.css
,하지만 렌더링 된 테이블에서 해당 스타일을 사용할 수있는 방법은 없습니다.
도와 주시겠습니까?
사용자 정의 스타일을 사용하는 방법에 대해 질문이 있거나 부트 스트랩 스타일이 작동하지 않습니까? – Jieter
질문은 내 사용자 정의 스타일을 사용하는 방법입니다. 나는 CSS에있는 사용자 정의 레이아웃을 테이블에 갖고 싶습니다. – gwaju