This repository has been archived by the owner on Mar 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Re-implement sorting in API responses #51
Comments
I've set the docs to have no |
It doesn't seem to be possible to sort by anything:
yields ProgrammingError: SELECT DISTINCT ON expressions must match initial ORDER BY expressions
LINE 1: SELECT COUNT(*) FROM (SELECT DISTINCT ON ("opencivicdata_bil...
^
File "django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "restless/views.py", line 106, in dispatch
response = super(Endpoint, self).dispatch(request, *args, **kwargs)
File "django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "imago/helpers.py", line 137, in _
return fn(self, request, *args, **kwargs)
File "imago/helpers.py", line 122, in _
return fn(self, request, *args, **kwargs)
File "imago/helpers.py", line 307, in get
data_page = self.paginate(data, page, per_page)
File "imago/helpers.py", line 266, in paginate
return paginator.page(page)
File "django/core/paginator.py", line 50, in page
number = self.validate_number(number)
File "django/core/paginator.py", line 39, in validate_number
if number > self.num_pages:
File "django/core/paginator.py", line 86, in _get_num_pages
if self.count == 0 and not self.allow_empty_first_page:
File "django/core/paginator.py", line 72, in _get_count
self._count = self.object_list.count()
File "django/db/models/query.py", line 371, in count
return self.query.get_count(using=self.db)
File "django/db/models/sql/query.py", line 483, in get_count
number = obj.get_aggregation(using, ['__count'])['__count']
File "django/db/models/sql/query.py", line 464, in get_aggregation
result = compiler.execute_sql(SINGLE)
File "django/db/models/sql/compiler.py", line 852, in execute_sql
cursor.execute(sql, params)
File "django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "django/db/utils.py", line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params) Is this the same or a different issue @mileswwatkins |
Hmm, I'm not sure, but I would suspect so. Regardless, fixing one will almost surely fix the other. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
As of now, it's impossible to
sort
search endpoints bycreated_at
and similardatetime
s. This may have something to do with #49.The text was updated successfully, but these errors were encountered: