Im new to django and Im helping in creating a website, now what they've requested is to show a specific number and Im trying to use a for loop it goes something like this:
class Students(models.Model):
...
section = (('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'))
BlockNumber = models.CharField(max_length=10, choices=section)
now what I want to do is to count each section choice in the Students model class. I've tried using the code below to count each choice:
def yearCount(request):
year = Students.objects.all(Count('year'))
blocks = Students.onjects.all(Count('section'))
context = {'year': year,'blocks': blocks}
return render(request, './chairperson/students/student_bsit1.html', context)
Any help would be appreciated, thank you.