> 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
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
> 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
> 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
4 matches
Mail list logo