If an issue belongs to only one magazine and an article belongs to only
one issue, then including both the magazine and the issue in the article
model is redundant, so if you can avoid it, I would.

On the other hand, I see your point that being able to quickly find the
right issue when you have every issue from every magazine as a choice
could be problematic. It'd be very hard to do in the admin, because you
want to limit the choices of issue to those that share the same
magazine. Unfortunately, when you create an article, it doesn't have a
magazine or an issue, so you can set the magazine, but the admin site
won't automatically update the issue choices for you, it will just
validate to make sure that you haven't picked an issue from a different
magazine than you picked. (As I said, redundancy which could lead to
problems.)

Is this something end users will need to get at? If so, I wouldn't
depend on the admin interface and would write my own view that would
allow someone to pick a magazine and then have another drop-down
(possibly updated using Ajax) that would be limited to its issues. When
you read the form, ignore the magazine and just record the issue.

If it's just you, add an ordering to issues that sorts by magazines and
dates (or whatever) and you can type the first few characters of the
magazine name to find yourself in the right general area.

Todd

On Sun, 2006-12-03 at 07:11 -0800, phess wrote:
> > So an article can be in more than one issue of a magazine?
> 
> Not at all. The Article belongs to only one Issue, which is what I want
> the ForeignKey to mean.
> I just want to limit the choices of Issues to the ones that make sense,
> i.e. to the Issues that belong to the chosen Magazine.
> 
> 
> > Just override the issue's __str__() method to include the name of the
> > magazine that it should have as a foreign key in its string
> > representation and you should be able to see what's what.
> 
> Yes, I'm already doing that, although I didn't show it. The issue's
> __str__() returns '%s-%s' %(magazine, number)
> 
> Phess


--~--~---------~--~----~------------~-------~--~----~
 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