Hello,
Everytime i try to access a url, the Django developer server auto quit
without any log about what happens.
After debugging a little bit, i find out if i remove this block of code in
the template file, i can access the web page normally:
<select name="department1" class="department">
<option value=""></option>
{% for d in departments %}
<option value="{{ d.id }}"> {{ d.name }} - {{ d.department_code }}
</option>
{% endfor %}
</select>
But i can iterate the QuerySet in the view normally, it seems like there
aren't any problem iterating the QuerySet:
def edit(request):
departments = Department.objects.filter()
for d in departments:
print(d.id, d.name, d.department_code)
return render(request, 'edit/edit.html', {'departments': departments})
I have no idea what is happening and it's driving me crazy. Any help would
be appreciated. Thank you.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/905973fa-6d90-4b45-bb69-ffcc787d2524%40googlegroups.com.