Chart.js не отображается на сайте django
Я пытаюсь отобразить графики с помощью chart.js, но они не отображаются... ниже приведен мой код
В файле Views.py я подготовил набор запросов для отображения того, сколько людей имеют аллергию на глютен, арахис и так далее...
def patientsView(request):
gluten_allergy = MedicalRecord.objects.filter(gluten_allergy = True).count()
# gluten_allergy = int(gluten_allergy)
print('Number of Gluten Allergy patients Are',gluten_allergy)
peanut_allergy = MedicalRecord.objects.filter(peanut_allergy = True).count()
# peanut_allergy = int(peanut_allergy)
print('Number of Peanut Allergy patients Are',peanut_allergy)
covid_history = MedicalRecord.objects.filter(covid_history=True).count()
# covid_history = int(covid_history)
print('Number of Covid History patients Are',covid_history)
ebola_history = MedicalRecord.objects.filter(ebola_history=True).count()
# ebola_history = int(ebola_history)
print('Number of Ebola History patients Are',ebola_history)
GROUP_A = MedicalRecord.objects.filter(blood_type='A').count()
# GERT = MedicalRecord.objects.filter(blood_type='A')
# GROUP_A = int(GROUP_A)
print('Number of Male Are',GROUP_A)
GROUP_B = MedicalRecord.objects.filter(blood_type='B').count()
# GROUP_B = int(GROUP_B)
print('Number of patients with Group B Are ' ,GROUP_B)
GROUP_AB = MedicalRecord.objects.filter(blood_type='AB').count()
# GROUP_AB = int(GROUP_AB)
print('Number of patients with Group AB Are', GROUP_AB)
GROUP_O = MedicalRecord.objects.filter(blood_type='O').count()
# GROUP_O = int(GROUP_O)
print('Number of patients with Group O Are', GROUP_O)
blood_type = ['GROUP_A', 'GROUP_B', 'GROUP_AB', 'GROUP_O']
blood_type_count = [GROUP_A, GROUP_B, GROUP_AB, GROUP_O]
condition_list = ['Gluten Allergy', 'Peanut Allergy', 'Covid History', 'Ebola History']
condition_list_count = [gluten_allergy, peanut_allergy, covid_history, ebola_history]
context = {'condition_list':condition_list,
'condition_list_count':condition_list_count,
'blood_type':blood_type,
'blood_type_count':blood_type_count}
return render(request, 'patients/homechart1F.html', context)
В моем Base.html загружена либрация javascipt для chart.js
...some codes...
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3/dist/Chart.min.js"></script>
...some codes
мои шаблоны можно найти в файле homechart1F.html ниже