Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #28437 -- Added support of complex geometry expressions in GIS lookups. #8813

Merged
merged 1 commit into from Jul 27, 2017

Conversation

sir-sigurd
Copy link
Member

self.assertTrue(lookups, 'No lookups found')
for lookup in lookups:
with self.subTest(lookup):
City.objects.filter(**{'point__' + lookup: functions.Union('point', 'point')}).exists()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Union is imported, so you could drop functions.
Is there not assertTrue/False because the results differ among databases?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That Union is aggregate.
Results differ among lookups, I don't think that it makes much sense to check them.

@@ -448,6 +448,17 @@ def test_relate_lookup(self):
self.assertEqual('Texas', Country.objects.get(mpoly__relate=(pnt2, intersects_mask)).name)
self.assertEqual('Lawrence', City.objects.get(point__relate=(ks.poly, intersects_mask)).name)

# With a complex geometry expression
self.assertFalse(City.objects.exclude(point__relate=(functions.Union('point', 'point'), within_mask)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't pass on Oracle: <QuerySet [<City: Houston>, <City: Dallas>, <City: Oklahoma City>, <City: Wellington>, <City: Pueblo>, <City: Lawrence>, <City: Chicago>, <City: Victoria>]> is not false.

@timgraham timgraham merged commit 6ebe3a9 into django:master Jul 27, 2017
@sir-sigurd sir-sigurd deleted the gis-lookups branch July 27, 2017 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants