Ticket #16421: 16421-test.diff
File 16421-test.diff, 1.4 KB (added by , 13 years ago) |
---|
-
tests/modeltests/serializers/tests.py
1 1 # -*- coding: utf-8 -*- 2 from datetime import datetime 2 from datetime import datetime, time 3 3 from StringIO import StringIO 4 4 from xml.dom import minidom 5 5 … … 134 134 serialized field list - it replaces the pk identifier. 135 135 """ 136 136 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)) 138 139 profile.save() 139 140 serial_str = serializers.serialize(self.serializer_name, 140 141 AuthorProfile.objects.all()) -
tests/modeltests/serializers/models.py
46 46 class AuthorProfile(models.Model): 47 47 author = models.OneToOneField(Author, primary_key=True) 48 48 date_of_birth = models.DateField() 49 time_of_birth = models.TimeField() 49 50 50 51 def __unicode__(self): 51 52 return u"Profile of %s" % self.author