#17310: Delete an object linked to a GenericForeignKey
-------------------------------------+-------------------------------------
     Reporter:  Natim                |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:                       |                  Version:  1.3
  contrib.contenttypes               |               Resolution:  invalid
     Severity:  Normal               |             Triage Stage:
     Keywords:                       |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Natim):

 Don't forget to override the fields in the GenericRelation.

 {{{
 class Award(models.Model):
     name = models.CharField(max_length=25)
     app_object_id = models.PositiveIntegerField()
     app_content_type = models.ForeignKey(ContentType)
     content_object = generic.GenericForeignKey('app_content_type',
 'app_object_id')

 class Person(models.Model):
     name = models.CharField(max_length=25)
     awards = generic.GenericRelation(Award,
                                      content_type_field=
 'app_content_type',
                                      object_id_field='app_object_id')
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17310#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to