1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

[1.11.x] Fixed #27603 -- Fixed AsKML when queryset is evaluated more than once.

Backport of e9149d3eb0 from master
This commit is contained in:
Sergey Fedoseev
2017-03-23 23:27:13 +05:00
committed by Tim Graham
parent a8c540accc
commit b6a6787fd8
2 changed files with 7 additions and 3 deletions

View File

@@ -122,8 +122,11 @@ class GISFunctionsTests(TestCase):
City.objects.annotate(kml=functions.AsKML('name'))
# Ensuring the KML is as expected.
ptown = City.objects.annotate(kml=functions.AsKML('point', precision=9)).get(name='Pueblo')
qs = City.objects.annotate(kml=functions.AsKML('point', precision=9))
ptown = qs.get(name='Pueblo')
self.assertEqual('<Point><coordinates>-104.609252,38.255001</coordinates></Point>', ptown.kml)
# Same result if the queryset is evaluated again.
self.assertEqual(qs.get(name='Pueblo').kml, ptown.kml)
@skipUnlessDBFeature("has_AsSVG_function")
def test_assvg(self):