Ticket #8316: db-mysqltypetest.diff

File db-mysqltypetest.diff, 1.1 KB (added by Julian Bez, 16 years ago)

Test case, currently fails when using MySQL+Innodb

  • tests/modeltests/custom_pk/models.py

     
    2828    def __unicode__(self):
    2929        return self.name
    3030
     31class 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   
     38class 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
    3145__test__ = {'API_TESTS':"""
    3246>>> dan = Employee(employee_code='ABC123', first_name='Dan', last_name='Jones')
    3347>>> dan.save()
     
    107121>>> emp = Employee(employee_code='jaźń')
    108122>>> emp.save()
    109123
     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
    110132"""}
Back to Top