500 error when searching on the admin page for product
sentry-io opened this issue · 1 comments
sentry-io commented
Sentry Issue: MITXONLINE-36B
FieldError: Cannot resolve keyword 'courseruns' into field. Choices are: basket_item, content_type, content_type_id, courserunproducts, created_on, description, discounts, id, is_active, object_id, price, programruns, purchasable_object, updated_on
(20 additional frame(s) were not displayed)
...
File "django/db/models/sql/query.py", line 1288, in build_filter
return self._add_q(
File "django/db/models/sql/query.py", line 1435, in _add_q
child_clause, needed_inner = self.build_filter(
File "django/db/models/sql/query.py", line 1309, in build_filter
lookups, parts, reffed_expression = self.solve_lookup_type(arg)
File "django/db/models/sql/query.py", line 1135, in solve_lookup_type
_, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
File "django/db/models/sql/query.py", line 1562, in names_to_path
raise FieldError("Cannot resolve keyword '%s' into field. "
rachellougee commented
This is due to the recent change to products' related_query_name in CourseRun model in this PR #1885
products = GenericRelation(
"ecommerce.Product", related_query_name="courserunproducts"
)
I think we just need to update courseruns
in https://github.com/mitodl/mitxonline/blob/main/ecommerce/admin.py#L51-L53 to use the new name