Query optimisation on attendee_data form

This commit is contained in:
Christopher Neugebauer 2016-10-05 12:07:38 -07:00
parent 7058260e5c
commit ffe5194893
2 changed files with 2 additions and 2 deletions

View file

@ -24,7 +24,7 @@ class DiscountForm(forms.Form):
class ProductAndCategoryForm(forms.Form):
product = forms.ModelMultipleChoiceField(
queryset=inventory.Product.objects.all(),
queryset=inventory.Product.objects.select_related("category"),
required=False,
)
category = forms.ModelMultipleChoiceField(

View file

@ -543,7 +543,7 @@ def attendee_data(request, form, user_id=None):
).exclude(
cart__status=commerce.Cart.STATUS_RELEASED
).select_related(
"cart", "product"
"cart", "cart__user", "product", "product__category",
).order_by("cart__status")
# Get all of the relevant attendee profiles in one hit.