Re: Do queries made instantiating a form not show up in db.connection.queries?

2018-11-01 Thread Jonathan Berger
Thank you!

I was looking at the value of 'connection.queries' before rendering the
form.

On Thu, Nov 1, 2018 at 6:12 PM Karen Tracey  wrote:

> On Thu, Nov 1, 2018 at 8:14 PM Jonathan Berger 
> wrote:
>
>>
>> Per the db and model FAQ
>> <https://docs.djangoproject.com/en/2.1/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running>:
>> expected behavior is that 'connection.queries' should contain a list of all
>> SQL queries made by an app.
>>
>> I'm finding actual behavior for a Form subclass that has a
>> ModelMultipleChoiceField with a default queryset, does not add that query
>> to 'connection.queries'. This violates expected behavior.
>>
>>
>
> https://docs.djangoproject.com/en/2.1/ref/forms/fields/#django.forms.ModelChoiceField.queryset
> notes the queryset is "evaluated when the form is rendered." ...are you
> rendering the form or just instantiating it (per the subject)?
>
> Karen
>
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACS9racCtAAgPLwv7-SBw-40Sddge_r9hpBS5eDBqE_1GGJbqA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACS9racCtAAgPLwv7-SBw-40Sddge_r9hpBS5eDBqE_1GGJbqA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN1jqrL%2B8z5hbKVGx1Hnw6S5C8FCX75s2myQjAEYUxJwbWmUWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Do queries made instantiating a form not show up in db.connection.queries?

2018-11-01 Thread Jonathan Berger
Hi Django Users,

I'm a moderate-level user of Django and trying to determine if I've found a
bug.

Per the db and model FAQ
:
expected behavior is that 'connection.queries' should contain a list of all
SQL queries made by an app.

I'm finding actual behavior for a Form subclass that has a
ModelMultipleChoiceField with a default queryset, does not add that query
to 'connection.queries'. This violates expected behavior.

Am I misunderstanding something or is this a bug?

Thanks,
Jonathan

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN1jqrL3WnSr6uWgUPBiowKd9VNpBFsR%2BeXkxERvTtSPcXH8fQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.