On 4/6/06, Rudolph <[EMAIL PROTECTED]> wrote:
No - this correct behaviour, as designed. Given the model:
class Item(models.Model):
name = models.CharField('Name')
parent = models.ForeignKey('self'')
you can query myitem.parent and myitem.item_set. However, if
parent = models.ForeignKey('self'', related_name='child')
you can query myitem.parent and myitem.child. The related_name is a user-specified replacement name for the model_set default name. Therefore, related_name should always be a plural/collection name (i.e., 'children', not 'child')
Russ Magee %-)
Is that an inconsistancy to be removed (ie a bug)?
No - this correct behaviour, as designed. Given the model:
class Item(models.Model):
name = models.CharField('Name')
parent = models.ForeignKey('self'')
you can query myitem.parent and myitem.item_set. However, if
parent = models.ForeignKey('self'', related_name='child')
you can query myitem.parent and myitem.child. The related_name is a user-specified replacement name for the model_set default name. Therefore, related_name should always be a plural/collection name (i.e., 'children', not 'child')
Russ Magee %-)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---