﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30455	Django ModelForm with multiple ForeignKey query optimisation issue.	Bishnu Bhattarai	nobody	"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."	Cleanup/optimization	closed	Database layer (models, ORM)	dev	Normal	invalid			Unreviewed	0	0	0	0	0	0
