Possible to push the whole code to a Github repo so someone could check out
and try locally - Couldn't really figure out anything that might be going
wrong by looking at this much mode?

Also, just out of curiosity, why are you using *Department.objects.filter()*
instead of *Department.objects.all()* since you are anyways not passing
anything to the filter.

--
Regards
Deep L Sukhwani


On Tue, 24 Sep 2019 at 20:23, Huy Bùi <[email protected]> wrote:

>     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
> <https://groups.google.com/d/msgid/django-users/905973fa-6d90-4b45-bb69-ffcc787d2524%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAEMqiPf-0NxxKjbWXPh7R7qZvPDLgOeamrhpCw7MASit8%3DB3vg%40mail.gmail.com.

Reply via email to