- Timestamp:
- 08/24/08 03:12:13 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/tests/regressiontests/fixtures_regress/models.py
r7803 r8515 7 7 name = models.CharField(max_length=150) 8 8 latin_name = models.CharField(max_length=150) 9 9 count = models.IntegerField() 10 10 11 def __unicode__(self): 11 12 return self.common_name 13 14 def animal_pre_save_check(signal, sender, instance, **kwargs): 15 "A signal that is used to check the type of data loaded from fixtures" 16 print 'Count = %s (%s)' % (instance.count, type(instance.count)) 12 17 13 18 class Plant(models.Model): … … 65 70 # will take a PK of 1 (on Postgres), and the save will fail. 66 71 # This is a regression test for ticket #3790. 67 >>> animal = Animal(name='Platypus', latin_name='Ornithorhynchus anatinus' )72 >>> animal = Animal(name='Platypus', latin_name='Ornithorhynchus anatinus', count=2) 68 73 >>> animal.save() 69 74 … … 135 140 [1, 2, 3, 4, 5, 6, 7, 8] 136 141 142 ############################################### 143 # Test for ticket #8298 - Field values should be coerced into the correct type 144 # by the deserializer, not as part of the database write. 145 146 >>> models.signals.pre_save.connect(animal_pre_save_check) 147 >>> management.call_command('loaddata', 'animal.xml', verbosity=0) 148 Count = 42 (<type 'int'>) 149 150 >>> models.signals.pre_save.disconnect(animal_pre_save_check) 151 137 152 """}
