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.