#3764: select_related() raises RuntimeError with ForeignKey('self') when record
linked to itself
-----------------------+----------------------------------------------------
Reporter: anonymous | Owner: adrian
Status: new | Component: Database wrapper
Version: SVN | Keywords: select_related, admin, maximum
recursion, ForeignKey
Stage: Unreviewed | Has_patch: 0
-----------------------+----------------------------------------------------
{{{
class Person(models.Model):
name = models.CharField(maxlength=100)
advocate = models.ForeignKey('self', null = False, related_name =
'customers')
person = Person.objects.create(name="First", advocate_id = 0)
person.save()
person.advocate = person
person.save()
}}}
Then
{{{
Person.objects.all().select_related()
}}}
will raise '''RuntimeException: maximum recursion depth exceeded in
cmp'''
Admin are of web-site also becomes frozen when you try to open 'Persons'
page
--
Ticket URL: <http://code.djangoproject.com/ticket/3764>
Django Code <http://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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---