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 with Django. Right now, my models.py looks like this
(simplified):

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 because if I try to create two themes with
the same name but in a different category (using the Admin app), it'll
complain that a theme with the same name already exists.

Can anyone help me with solving this problem?

Rob


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