Django Print Loop Value Only Once
I have a view where I am getting the list of appointments with limit.. def HospitalAppointmentView(request, pk, username, hdpk): todays_appointments = DoctorAppointment.objects.fil
Solution 1:
You can use {{forloop.first}}
for, it will be true for 1st iteration.
Like ...
{% for appointment in todays_appointments %}
{% if forloop.first %}
<h3>{{appointment.doctor.username}}<h3>
{%endif%}
...
{%endfor%}
Post a Comment for "Django Print Loop Value Only Once"