Ticket #21565: 21565.diff

File 21565.diff, 2.1 KB (added by Aymeric Augustin, 11 years ago)
  • django/contrib/gis/tests/relatedapp/models.py

    diff --git a/django/contrib/gis/tests/relatedapp/models.py b/django/contrib/gis/tests/relatedapp/models.py
    index 3b4364f..5221bbe 100644
    a b class Article(SimpleModel):  
    7171class Book(SimpleModel):
    7272    title = models.CharField(max_length=100)
    7373    author = models.ForeignKey(Author, related_name='books', null=True)
     74
     75
     76class Event(SimpleModel):
     77    name = models.CharField(max_length=100)
     78    when = models.DateTimeField()
  • django/contrib/gis/tests/relatedapp/tests.py

    diff --git a/django/contrib/gis/tests/relatedapp/tests.py b/django/contrib/gis/tests/relatedapp/tests.py
    index b478005..00664e0 100644
    a b from unittest import skipUnless  
    55from django.contrib.gis.geos import HAS_GEOS
    66from django.contrib.gis.tests.utils import HAS_SPATIAL_DB, mysql, oracle, no_mysql, no_oracle, no_spatialite
    77from django.test import TestCase
     8from django.test.utils import override_settings
     9from django.utils import timezone
    810
    911if HAS_GEOS:
    1012    from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
    1113    from django.contrib.gis.geometry.backend import Geometry
    1214    from django.contrib.gis.geos import GEOSGeometry, Point, MultiPoint
    1315
    14     from .models import City, Location, DirectoryEntry, Parcel, Book, Author, Article
     16    from .models import City, Location, DirectoryEntry, Parcel, Book, Author, Article, Event
    1517
    1618
    1719@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
    class RelatedGeoModelTest(TestCase):  
    187189            self.assertEqual(m.point, d['point'])
    188190            self.assertEqual(m.point, t[1])
    189191
     192    @override_settings(USE_TZ=True)
     193    def test07b_values(self):
     194        "Testing values() and values_list() with aware datetime. See #21565."
     195        Event.objects.create(name="foo", when=timezone.now())
     196        print Event.objects
     197        list(Event.objects.values_list('when'))
     198
    190199    def test08_defer_only(self):
    191200        "Testing defer() and only() on Geographic models."
    192201        qs = Location.objects.all()
Back to Top