[EMAIL PROTECTED] wrote: > We're driving right past each other on the information > superhighway. > Thanks for your advice, Russ. It still seems to me that a > many-to-many relationship between days and events would be desirable, > for the same reasons that all many-to-many relationships are desirable. > > In my case, I don't want to record minutes at a particular meeting > (for example) -- I just want to be able to publish the fact that the > meeting is happening tonight, as it does every third Saturday at 7 p.m. > For my purposes, it seems very unDRY to have to put a new record in the > database every time that third Saturday rolls around. > > Very best, > > Hank Sims
Hank, I'm a little confused. Your example uses a ForeignKey to relate Meeting to MyDay but above you say you'd like a many-to-many relationship. Have you tried: class MyDay: def __init__(self, date): self.id = date.toordinal() self.date = date class Concert(models.Model): title = models.CharField(maxlength=50) description = models.CharField(maxlength=50) date = models.ManyToManyField(MyDay) class Meeting(models.Model): title = models.CharField(maxlength=50) description = models.CharField(maxlength=50) date = models.ManyToManyField(MyDay) Which *should* allow this in your templates: {% for concert in myday.concert_set %} {{ concert.title}} {{ concert.description }} {% endfor %} {% for meeting in myday.meeting_set %} {{ meeting.title}} {{ meeting.description }} {% endfor %} Or maybe I'm misunderstanding what you are trying to do? BTW, here is more info on M2M's: http://www.djangoproject.com/documentation/models/many_to_many/ -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?hl=en -~----------~----~----~----~------~----~------~--~---