Hi,
I have the following model:
class Program(models.Model):
name = models.CharField(max_length = 128)
def __unicode__(self):
return self.name
class Cheat(models.Model):
program = models.ForeignKey(Program)
shortcut = models.CharField(max_length = 64)
description = models.CharField(max_length = 512)
def __unicode__(self):
return u"(%s) - %s" % (self.shortcut, self.description)
class Category(models.Model):
#program = models.ForeignKey(Program)
name = models.CharField(max_length = 128)
def __unicode__(self):
return self.name
class Sheet(models.Model):
program = models.ForeignKey(Program)
name = models.CharField(max_length = 128)
def __unicode__(self):
return self.name
class CategorizedCheat(models.Model):
order = models.IntegerField(unique = True)
sheet = models.ForeignKey(Sheet)
cheat = models.ForeignKey(Cheat)
category = models.ForeignKey(Category)
def __unicode__(self):
return unicode(self.cheat)
In the admin, I want to display a Sheet with CategorizedCheats inline. The problem is that I'm unable to have only Cheat that are related to the same Program as the Sheet. Is there a way to filter thoses with the Sheet.program ? Or is there something wrong with my models ?