2 | | In [19]: import django |
3 | | |
4 | | In [20]: django.VERSION |
5 | | Out[20]: (1, 8, 7, 'final', 0) |
6 | | |
7 | | In [21]: print Record.objects.filter(pk__in=[]) |
8 | | [] |
9 | | In [22]: print Record.objects.filter(pk__in=[]).query |
10 | | --------------------------------------------------------------------------- |
11 | | EmptyResultSet Traceback (most recent call last) |
12 | | <ipython-input-22-e81ae73ee15f> in <module>() |
13 | | ----> 1 print Record.objects.filter(pk__in=[]).query |
14 | | |
15 | | /home/adas/.virtualenvs/poradnia/local/lib/python2.7/site-packages/django/db/models/sql/query.pyc in __str__(self) |
16 | | 213 done by the database interface at execution time. |
17 | | 214 """ |
18 | | --> 215 sql, params = self.sql_with_params() |
19 | | 216 return sql % params |
20 | | 217 |
21 | | |
22 | | /home/adas/.virtualenvs/poradnia/local/lib/python2.7/site-packages/django/db/models/sql/query.pyc in sql_with_params(self) |
23 | | 221 substituted into the query. |
24 | | 222 """ |
25 | | --> 223 return self.get_compiler(DEFAULT_DB_ALIAS).as_sql() |
26 | | 224 |
27 | | 225 def __deepcopy__(self, memo): |
28 | | |
29 | | /home/adas/.virtualenvs/poradnia/local/lib/python2.7/site-packages/django/db/models/sql/compiler.pyc in as_sql(self, with_limits, with_col_aliases, subquery) |
30 | | 385 from_, f_params = self.get_from_clause() |
31 | | 386 |
32 | | --> 387 where, w_params = self.compile(self.query.where) |
33 | | 388 having, h_params = self.compile(self.query.having) |
34 | | 389 params = [] |
35 | | |
36 | | /home/adas/.virtualenvs/poradnia/local/lib/python2.7/site-packages/django/db/models/sql/compiler.pyc in compile(self, node, select_format) |
37 | | 355 sql, params = vendor_impl(self, self.connection) |
38 | | 356 else: |
39 | | --> 357 sql, params = node.as_sql(self, self.connection) |
40 | | 358 if select_format and not self.subquery: |
41 | | 359 return node.output_field.select_format(self, sql, params) |
42 | | |
43 | | /home/adas/.virtualenvs/poradnia/local/lib/python2.7/site-packages/django/db/models/sql/where.pyc in as_sql(self, compiler, connection) |
44 | | 131 return '', [] |
45 | | 132 else: |
46 | | --> 133 raise EmptyResultSet |
47 | | 134 if full_needed - everything_childs <= 0: |
48 | | 135 if self.negated: |
49 | | |
50 | | EmptyResultSet: |
51 | | |
| 2 | Internal Server Error: /api/travel/places/ |
| 3 | Traceback (most recent call last): |
| 4 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner |
| 5 | response = get_response(request) |
| 6 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response |
| 7 | response = wrapped_callback(request, *callback_args, **callback_kwargs) |
| 8 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view |
| 9 | return view_func(*args, **kwargs) |
| 10 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view |
| 11 | return self.dispatch(request, *args, **kwargs) |
| 12 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch |
| 13 | response = self.handle_exception(exc) |
| 14 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception |
| 15 | self.raise_uncaught_exception(exc) |
| 16 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception |
| 17 | raise exc |
| 18 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch |
| 19 | response = handler(request, *args, **kwargs) |
| 20 | File "/Users/User/Projects/travel/travel_backend/travel/views.py", line 2141, in export |
| 21 | sql, params = queryset.none().query.sql_with_params() |
| 22 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/db/models/sql/query.py", line 264, in sql_with_params |
| 23 | return self.get_compiler(DEFAULT_DB_ALIAS).as_sql() |
| 24 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 513, in as_sql |
| 25 | where, w_params = self.compile(self.where) if self.where is not None else ("", []) |
| 26 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 430, in compile |
| 27 | sql, params = node.as_sql(self, self.connection) |
| 28 | File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/db/models/sql/where.py", line 99, in as_sql |
| 29 | raise EmptyResultSet |
| 30 | django.core.exceptions.EmptyResultSet |