seed
seed copied to clipboard
Unable to filter inventory by derived columns
Describe the bug
I'm unable to filter the inventory by a derived column on the new/beta inventory list. It seems to work fine on the old inventory list.
Actual Behavior
After typing in a filter, the spinner wheel appears, and I see an error for this POST request (where "Source EUI Recalculated" is the name of the derived column):
https://seeddemostaging.lbl.gov/api/v3/properties/filter/?Source EUI Recalculated__icontains=1&cycle=404&include_related=true&organization_id=303&page=1&per_page=100
Steps to Reproduce
- Add a derived column to a column profile.
- Type anything into that column's filter box.
Instance Information
I found this error on one of ClearlyEnergy's instances of BEAM, which I'm currently updating to v2.15.1, but I confirmed that the bug was also in SEED on seeddemostaging.lbl.gov.
Additional Context
My error log from running BEAM locally (where the name of the column is "Derived column"):
File ".../seed/views/v3/properties.py", line 532, in filter
return get_filtered_results(request, 'property', profile_id=profile_id)
File ".../seed/utils/inventory_filter.py", line 110, in get_filtered_results
views_list = views_list.annotate(**annotations).filter(filters).order_by(*order_by)
...
File ".../.pyenv/versions/seed/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1339, in build_filter
raise FieldError('Related Field got invalid lookup: {}'.format(lookups[0]))
django.core.exceptions.FieldError: Related Field got invalid lookup: Derived column
This issue has been automatically marked as stale because it has not had recent activity within 60 days. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been closed automatically. If this still affects you please re-open this issue with a comment or contact us so we can look into resolving it.
This is still needed.
Issue #3438 should fix this issue as well. Therefore, refer to the progress of that issue.
I'm going to close this ticket since it is effectively a duplicate of #3438.