1 | ---------------------------------------------------------------------------
|
---|
2 | ValueError Traceback (most recent call last)
|
---|
3 | <ipython-input-3-2eb30d547061> in <module>()
|
---|
4 | ----> 1 models.Resource.objects.get_or_create(coords=resource.coords)
|
---|
5 |
|
---|
6 | /django/db/models/manager.py in manager_method(self, *args, **kwargs)
|
---|
7 | 83 def create_method(name, method):
|
---|
8 | 84 def manager_method(self, *args, **kwargs):
|
---|
9 | ---> 85 return getattr(self.get_queryset(), name)(*args, **kwargs)
|
---|
10 | 86 manager_method.__name__ = method.__name__
|
---|
11 | 87 manager_method.__doc__ = method.__doc__
|
---|
12 |
|
---|
13 | /django/db/models/query.py in get_or_create(self, defaults, **kwargs)
|
---|
14 | 471 self._for_write = True
|
---|
15 | 472 try:
|
---|
16 | --> 473 return self.get(**lookup), False
|
---|
17 | 474 except self.model.DoesNotExist:
|
---|
18 | 475 return self._create_object_from_params(lookup, params)
|
---|
19 |
|
---|
20 | /django/db/models/query.py in get(self, *args, **kwargs)
|
---|
21 | 377 if self.query.can_filter() and not self.query.distinct_fields:
|
---|
22 | 378 clone = clone.order_by()
|
---|
23 | --> 379 num = len(clone)
|
---|
24 | 380 if num == 1:
|
---|
25 | 381 return clone._result_cache[0]
|
---|
26 |
|
---|
27 | /django/db/models/query.py in __len__(self)
|
---|
28 | 236
|
---|
29 | 237 def __len__(self):
|
---|
30 | --> 238 self._fetch_all()
|
---|
31 | 239 return len(self._result_cache)
|
---|
32 | 240
|
---|
33 |
|
---|
34 | /django/db/models/query.py in _fetch_all(self)
|
---|
35 | 1085 def _fetch_all(self):
|
---|
36 | 1086 if self._result_cache is None:
|
---|
37 | -> 1087 self._result_cache = list(self.iterator())
|
---|
38 | 1088 if self._prefetch_related_lookups and not self._prefetch_done:
|
---|
39 | 1089 self._prefetch_related_objects()
|
---|
40 |
|
---|
41 | /django/db/models/query.py in __iter__(self)
|
---|
42 | 52 # Execute the query. This will also fill compiler.select, klass_info,
|
---|
43 | 53 # and annotations.
|
---|
44 | ---> 54 results = compiler.execute_sql()
|
---|
45 | 55 select, klass_info, annotation_col_map = (compiler.select, compiler.klass_info,
|
---|
46 | 56 compiler.annotation_col_map)
|
---|
47 |
|
---|
48 | /django/db/models/sql/compiler.py in execute_sql(self, result_type)
|
---|
49 | 822 result_type = NO_RESULTS
|
---|
50 | 823 try:
|
---|
51 | --> 824 sql, params = self.as_sql()
|
---|
52 | 825 if not sql:
|
---|
53 | 826 raise EmptyResultSet
|
---|
54 |
|
---|
55 | /django/db/models/sql/compiler.py in as_sql(self, with_limits, with_col_aliases, subquery)
|
---|
56 | 374 from_, f_params = self.get_from_clause()
|
---|
57 | 375
|
---|
58 | --> 376 where, w_params = self.compile(self.where) if self.where is not None else ("", [])
|
---|
59 | 377 having, h_params = self.compile(self.having) if self.having is not None else ("", [])
|
---|
60 | 378 params = []
|
---|
61 |
|
---|
62 | /django/db/models/sql/compiler.py in compile(self, node, select_format)
|
---|
63 | 351 sql, params = vendor_impl(self, self.connection)
|
---|
64 | 352 else:
|
---|
65 | --> 353 sql, params = node.as_sql(self, self.connection)
|
---|
66 | 354 if select_format and not self.subquery:
|
---|
67 | 355 return node.output_field.select_format(self, sql, params)
|
---|
68 |
|
---|
69 | /django/db/models/sql/where.py in as_sql(self, compiler, connection)
|
---|
70 | 77 for child in self.children:
|
---|
71 | 78 try:
|
---|
72 | ---> 79 sql, params = compiler.compile(child)
|
---|
73 | 80 except EmptyResultSet:
|
---|
74 | 81 empty_needed -= 1
|
---|
75 |
|
---|
76 | /django/db/models/sql/compiler.py in compile(self, node, select_format)
|
---|
77 | 351 sql, params = vendor_impl(self, self.connection)
|
---|
78 | 352 else:
|
---|
79 | --> 353 sql, params = node.as_sql(self, self.connection)
|
---|
80 | 354 if select_format and not self.subquery:
|
---|
81 | 355 return node.output_field.select_format(self, sql, params)
|
---|
82 |
|
---|
83 | /django/contrib/gis/db/models/lookups.py in as_sql(self, compiler, connection)
|
---|
84 | 145 template_params.update(self.template_params)
|
---|
85 | 146 rhs_op = self.get_rhs_op(connection, rhs_sql)
|
---|
86 | --> 147 return rhs_op.as_sql(connection, self, template_params, sql_params)
|
---|
87 | 148
|
---|
88 | 149
|
---|
89 |
|
---|
90 | /django/contrib/gis/db/backends/postgis/operations.py in as_sql(self, connection, lookup, template_params, *args)
|
---|
91 | 37 if lookup.lhs.output_field.geography and not self.geography:
|
---|
92 | 38 raise ValueError('PostGIS geography does not support the "%s" '
|
---|
93 | ---> 39 'function/operator.' % (self.func or self.op,))
|
---|
94 | 40
|
---|
95 | 41 template_params = self.check_raster(lookup, template_params)
|
---|
96 |
|
---|
97 | ValueError: PostGIS geography does not support the "~=" function/operator.
|
---|