Ticket #13203: 13203_r12773.tests.diff

File 13203_r12773.tests.diff, 1.8 KB (added by ramusus, 15 years ago)

tests for recreating error

  • tests/regressiontests/generic_relations_regress/tests.py

     
    7070            Q(notes__note__icontains=r'other note'))
    7171        self.assertTrue(org_contact in qs)
    7272
    73 
    74 
     73    def test_inherited_models_delete(self):
     74         p = PersonWithComments.objects.create(account=23, name='Chef')
     75         p.delete()
     76 No newline at end of file
  • tests/regressiontests/generic_relations_regress/models.py

     
    11from django.db import models
    22from django.contrib.contenttypes import generic
    33from django.contrib.contenttypes.models import ContentType
     4from django.contrib.comments.models import Comment
    45
    5 __all__ = ('Link', 'Place', 'Restaurant', 'Person', 'Address', 
    6            'CharLink', 'TextLink', 'OddRelation1', 'OddRelation2', 
    7            'Contact', 'Organization', 'Note')
     6__all__ = ('Link', 'Place', 'Restaurant', 'Person', 'Address',
     7           'CharLink', 'TextLink', 'OddRelation1', 'OddRelation2',
     8           'Contact', 'Organization', 'Note', 'PersonWithComments')
    89
    910class Link(models.Model):
    1011    content_type = models.ForeignKey(ContentType)
     
    7778    name = models.CharField(max_length=255)
    7879    contacts = models.ManyToManyField(Contact, related_name='organizations')
    7980
     81class NewComment(Comment):
     82    title = models.CharField(max_length=60)
     83
     84class PersonWithComments(Person):
     85    comments = generic.GenericRelation(NewComment, object_id_field='object_pk')
     86
Back to Top