File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
django_mongodb_backend/gis Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 11from django .contrib .gis .db .models .lookups import DistanceLookupFromFunction , GISLookup
2+ from django .db import NotSupportedError
23
34from django_mongodb_backend .query_utils import process_lhs , process_rhs
45
56
67def _gis_lookup (self , compiler , connection , as_expr = False ):
78 lhs_mql = process_lhs (self , compiler , connection , as_expr = as_expr )
89 rhs_mql = process_rhs (self , compiler , connection , as_expr = as_expr )
9- rhs_op = self .get_rhs_op (connection , rhs_mql )
10+ try :
11+ rhs_op = self .get_rhs_op (connection , rhs_mql )
12+ except KeyError :
13+ raise NotSupportedError (f"MongoDB does not support the '{ self .lookup_name } ' lookup." )
1014 return rhs_op .as_mql (lhs_mql , rhs_mql , self .rhs_params )
1115
1216
Original file line number Diff line number Diff line change 88@skipUnlessDBFeature ("gis_enabled" )
99class LookupTests (TestCase ):
1010 def test_unsupported_lookups (self ):
11- msg = "MongoDB does not support the same_as lookup."
11+ msg = "MongoDB does not support the ' same_as' lookup."
1212 with self .assertRaisesMessage (NotSupportedError , msg ):
1313 City .objects .get (point__same_as = Point (95 , 30 ))
You can’t perform that action at this time.
0 commit comments