Hey there, A M2M field creates an intermediary join table which doesn't show up in the admin, or other places. It's basically just a pairing of Journalist ids with Article ids, and the M2M field is a convenience that allows you to ignore this table. If you want to add additional information to this intermediary table (which is what you're doing), you'll have to create the table explicitly, and use it yourself. There are instructions for doing so here:
http://www.djangoproject.com/documentation/models/m2m_intermediary/ which coincidentally use an example very similar to your setup... Good luck! Eric On Jun 27, 2008, at 11:55 AM, bhunter wrote: > > Hi, sorry for what is probably a trivial question, but I'm new to > Django and a little fuzzy on databases in general, so I hope someone > here can help. Just to keep the motif, I'll frame my question in > terms of journalism. > > I'd like to set up a database with the following relationships: a > model of articles and a model of journalists. That's easy enough. > Because one article can have multiple journalists associated with it, > that's a ManyToMany relationship: > > class Journalist(models.Model): > pass > > class Article(models.Model): > journalists = models.ManyToManyField(Journalist) > > Simple, but that's not what I happen to want. What I really want in > my application is to know the *status* of a journalist with respect to > an article. That status could be, let's say, one of four things: > ["Unafilliated", "CurrentlyWriting", "DoneWriting", "Dead"]. > > Coming from a Python background, I might just call this a dictionary > of statuses, with Journalists being the keys, and each entry > containing one of four values: > > class Article(models.Model): > status = { "Bob Ryan" : "CurrentlyWriting", > "Rob Bradford" : "Unaffiliated", > "Peter Gammons" : "DoneWriting", > "Dan Shaughnessy" : "Dead"} > > Ok, Shaughnessy isn't dead, but if you lived in Boston, you'd > understand. Anyway, a dictionary is nice and all, but then the > information isn't in the database, and that's the whole point. > > Can anyone tell me what this relationship is called and how to do it > in Django? > > Thanks! > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---