I'm trying to create a model that relates back to itself with a ManyToManyField. Here's my model:
class PressRun(models.Model):
starttime = models.DateTimeField(db_index=True)
endtime = models.DateTimeField
(validator_list=[endAfterStartValidator])
name = models.CharField(maxlength=100,blank=True)
recurringitem = models.ForeignKey(RecurringPressRun,blank=True,null=True)
edition = models.IntegerField(choices=EDITION_CHOICES,blank=True,null=True)
press_id = models.IntegerField(choices=PRESS_CHOICES,blank=True,default=1)
insert_into = models.ManyToManyField('self',
null=True,
blank=True,
related_name='insert')
The problem is that the model doesn't seem to use the related_name option. PressRun objects have an insert_into property, but no insert property. I'm actually trying to say that the result of a PressRun can be "inserted" into another PressRun, but I don't want to make a separate object (like PressRunInsert or something). I'd like to use a simple ManyToMany, but the objects don't have a distinction between "inserted into" and "insert of".
Does that make sense?
Dave
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
- ManyToMany with related_name? Dave St.Germain
- Re: ManyToMany with related_name? Russell Keith-Magee