Ticket #17310: kill_test.2.patch

File kill_test.2.patch, 1.0 KB (added by Rémy Hubscher, 12 years ago)

If the GenericRelation is defined correctly no problem.

  • models.py

    old new  
    55
    66class Award(models.Model):
    77    name = models.CharField(max_length=25)
    8     object_id = models.PositiveIntegerField()
    9     content_type = models.ForeignKey(ContentType)
    10     content_object = generic.GenericForeignKey()
     8    app_object_id = models.PositiveIntegerField()
     9    app_content_type = models.ForeignKey(ContentType)
     10    content_object = generic.GenericForeignKey('app_content_type', 'app_object_id')
    1111
    1212class AwardNote(models.Model):
    1313    award = models.ForeignKey(Award)
     
    1515
    1616class Person(models.Model):
    1717    name = models.CharField(max_length=25)
    18     awards = generic.GenericRelation(Award)
     18    awards = generic.GenericRelation(Award,
     19                                     content_type_field= 'app_content_type',
     20                                     object_id_field='app_object_id')
    1921
    2022class Book(models.Model):
    2123    pagecount = models.IntegerField()
Back to Top