Richard,

I see your point, but there could be many, many issues for each
magazine, and over a hundred magazines total, so I don't want to make
the users wade through a few thousand issues each time. I'd like to be
able to drill down, first pick a magazine, then one of its issues.

What I'm thinking is do it backwards: give Magazine a
ManyToManyField(Issue), and Issue a ManyToManyField(Article), so you
create or select a Magazine, add an Issue, and then add Articles to
it.

Thanks!

Rodrigo


On Apr 14, 4:19 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
> This is where I would suggest you rethink your data model.  Is there a
> reason to link Article to both Issues and Magazine?
>
> Why not something like:
>
> Issues has FK (magazine) to Magazine
> Articles has FK (issue) to Issues
>
> Issues could be configured to return its magazine.title and
> self.issue_number (or whatever) in its __unicode__() function so when you
> created an article, you would make one selection: the issue the article was
> in.  If the articles could be in multiple issues, make the Article.issues a
> [EMAIL PROTECTED]
> hth,
> -richard
>
> On 4/14/08, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have 3 models: Magazine, Issue and Article.
> > Each Magazine has 1 or more Issues and each Issue has 1 or more
> > Articles.
> > Article has models.ForeignKey(Issue) and models.ForeignKey(Magazine).
> > Issue has models.ForeignKey(Magazine)).
> > In the admin, when creating a new article, I choose which Magazine it
> > belongs to and then which Issue of  that Magazine.
>
> > Is there a way to limit the Issues to only those that belong to the
> > chosen Magazine?
>
> > Could this be done by dynamically updating the list of Issues when you
> > select a Magazine, without needing to save the record first?
> > JavaScript, AJAX maybe?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to