#30455: Django ModelForm with multiple ForeignKey query optimisation issue.
------------------------------------------------+------------------------
               Reporter:  bishnusyangja         |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  new
              Component:  Forms                 |        Version:  2.1
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 In django ModelForm, I have two foreignkey fields 'account' and reference,

 self.fields['account'].queryset = Account.objects.all()
 self.fields['reference'].queryset = Billing.objects.all()

 I have 2000 rows in Account table and 4000 rows in Billing table.
 While rendering this form, server responded with 504 status.

 I thought, while rendering this form, these two queryset  are executed at
 once and sets the options in choice filed. But I found the queryset are
 executed in loop and response server error 504. This is because database
 is hit for every choices of foreignkey and db-query is executed in loop.

 Hoping the issue will be resolved soon.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30455>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.8dfa6017d2ec9680fb24377416f96e88%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to