kanedata / find-that-charity

Reconciliation for UK Charities and other nonprofit organisations, with elasticsearch back end.
https://findthatcharity.uk/
MIT License
28 stars 9 forks source link

Download CSV doesn't work when location selection is used #118

Closed drkane closed 1 year ago

drkane commented 2 years ago

E.g. https://findthatcharity.uk/orgid/type/registered-charity?q=&location=E12000007

Clicking "Download CSV" results in a failed download.

error:

FieldError: Cannot resolve keyword 'locations' into field. Choices are: active, addressCountry, addressLocality, addressRegion, alternateName, charityNumber, companyNumber, dateModified, dateRegistered, dateRemoved, description, domain, email, id, latestIncome, latestIncomeDate, linked_orgs, name, orgIDs, org_id, org_id_scheme, org_id_scheme_id, organisationType, organisationTypePrimary, organisationTypePrimary_id, parent, postalCode, scrape, scrape_id, source, source_id, spider, status, streetAddress, telephone, url
  File "ftc/views.py", line 191, in stream
    s.run_db()
  File "ftc/query.py", line 283, in run_db
    self.query = Organisation.objects.filter(*db_filter)
  File "django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "django/db/models/query.py", line 941, in filter
    return self._filter_or_exclude(False, args, kwargs)
  File "django/db/models/query.py", line 961, in _filter_or_exclude
    clone._filter_or_exclude_inplace(negate, args, kwargs)
  File "django/db/models/query.py", line 968, in _filter_or_exclude_inplace
    self._query.add_q(Q(*args, **kwargs))
  File "django/db/models/sql/query.py", line 1416, in add_q
    clause, _ = self._add_q(q_object, self.used_aliases)
  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 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. "
drkane commented 1 year ago

Now fixed in 64502d4ab5a2727be8c87e080130be131ca73d7e