Ticket #16421: 16421-test.diff

File 16421-test.diff, 1.4 KB (added by Aymeric Augustin, 8 years ago)
  • tests/modeltests/serializers/tests.py

     
    11# -*- coding: utf-8 -*-
    2 from datetime import datetime
     2from datetime import datetime, time
    33from StringIO import StringIO
    44from xml.dom import minidom
    55
     
    134134        serialized field list - it replaces the pk identifier.
    135135        """
    136136        profile = AuthorProfile(author=self.joe,
    137                                 date_of_birth=datetime(1970,1,1))
     137                                date_of_birth=datetime(1970, 1, 1),
     138                                time_of_birth=time(12, 30, 45))
    138139        profile.save()
    139140        serial_str = serializers.serialize(self.serializer_name,
    140141                                           AuthorProfile.objects.all())
  • tests/modeltests/serializers/models.py

     
    4646class AuthorProfile(models.Model):
    4747    author = models.OneToOneField(Author, primary_key=True)
    4848    date_of_birth = models.DateField()
     49    time_of_birth = models.TimeField()
    4950
    5051    def __unicode__(self):
    5152        return u"Profile of %s" % self.author
Back to Top