Ticket #8316: db-mysqltypetest.diff
File db-mysqltypetest.diff, 1.1 KB (added by , 16 years ago) |
---|
-
tests/modeltests/custom_pk/models.py
28 28 def __unicode__(self): 29 29 return self.name 30 30 31 class Department(models.Model): 32 id = models.PositiveIntegerField(primary_key=True) 33 name = models.CharField(max_length=200) 34 35 def __unicode__(self): 36 return self.name 37 38 class Worker(models.Model): 39 department = models.ForeignKey(Department) 40 name = models.CharField(max_length=200) 41 42 def __unicode__(self): 43 return self.name 44 31 45 __test__ = {'API_TESTS':""" 32 46 >>> dan = Employee(employee_code='ABC123', first_name='Dan', last_name='Jones') 33 47 >>> dan.save() … … 107 121 >>> emp = Employee(employee_code='jaźń') 108 122 >>> emp.save() 109 123 124 # Check Department and Worker 125 >>> d = Department(id=10, name='IT') 126 >>> d.save() 127 >>> w = Worker(department=d, name='Full-time') 128 >>> w.save() 129 >>> w 130 <Worker: Full-time> 131 110 132 """}