Re: Beginner: (db) help with assigning unique names to multiple ForeignKeys

2007-06-26 Thread Tim Chase
> However, because the theme names aren't unique and there can > be multiple themes with the same name associated with > different categories, it makes it impossible to choose the > correct theme when adding an image. > > For example, if I have the following categories and themes: > > Contact T

Re: Beginner: (db) help with assigning unique names to multiple ForeignKeys

2007-06-26 Thread rob
Thanks for the help - I actually read abount unique_together shortly after creating this post. I did have one more question, however. Each theme has a number of images associated with it (with an Image model and a theme ForeignKey), so naturally when you go to add an image via the Admin app, ther

RE: Beginner: (db) help with assigning unique names to multiple ForeignKeys

2007-06-26 Thread Chris Brand
> I have a "Category" and "Theme" table. Each category can have a number > of themes, and while a theme with the same name can belong to > different categories, more than one theme with the same name shouldn't > belong to the same category. I'm having a hard time figuring out how > to set this up

Re: Beginner: (db) help with assigning unique names to multiple ForeignKeys

2007-06-26 Thread Tim Chase
> class Category(models.Model): > name = models.CharField(maxlength=50, unique=True) > > class Theme(models.Model): > category = models.ForeignKey(Category) > name = models.CharField(maxlength=50, unique=True) > > And an example of what I'd like: > > This obviously doesn't work beca