Metric.objects.filter().order_by('-date__week_day')[:7]
Как отсортировать чтоб был порядок от ПН до ВС. Использую django 1.10
Traceback (most recent call last): File "/home/abc/lib/python3.4/site-packages/django/core/handlers/exception.py", line 42, in inner response = get_response(request) File "/home/abc/lib/python3.4/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/home/abc/lib/python3.4/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/abc/back/statistic/views.py", line 98, in graph for i in m: File "/home/abc/lib/python3.4/site-packages/django/db/models/query.py", line 256, in __iter__ self._fetch_all() File "/home/abc/lib/python3.4/site-packages/django/db/models/query.py", line 1087, in _fetch_all self._result_cache = list(self.iterator()) File "/home/abc/lib/python3.4/site-packages/django/db/models/query.py", line 54, in __iter__ results = compiler.execute_sql() File "/home/abc/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 824, in execute_sql sql, params = self.as_sql() File "/home/abc/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 369, in as_sql extra_select, order_by, group_by = self.pre_sql_setup() File "/home/abc/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 47, in pre_sql_setup order_by = self.get_order_by() File "/home/abc/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 293, in get_order_by field, self.query.get_meta(), default_order=asc)) File "/home/abc/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 553, in find_ordering_name field, targets, alias, joins, path, opts = self._setup_joins(pieces, opts, alias) File "/home/abc/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 586, in _setup_joins pieces, opts, alias) File "/home/abc/lib/python3.4/site-packages/django/db/models/sql/query.py", line 1402, in setup_joins names, opts, allow_many, fail_on_missing=True) File "/home/abc/lib/python3.4/site-packages/django/db/models/sql/query.py", line 1370, in names_to_path " not permitted." % (names[pos + 1], name)) django.core.exceptions.FieldError: Cannot resolve keyword 'week_day' into field. Join on 'date' not permitted. [22/Mar/2017 11:47:53] "GET /graph HTTP/1.1" 500 111277