I have (essentially) the following models:
class foo(models.model):
name = models.CharField(max_length=255)
size = models.PositiveIntegerField()
class bar(foo):
colour = models.CharField(max_length=25)
class baz(foo):
material = models.CharField(max_length=25)
What I want to do is filter these models based on url parameters. So, if the url is http://www.mysite.com/catalogue/foo?size=3
then all foo
,bar
, and baz
objects that are size 3 are displayed.
If the url is http://www.mysite.com/catalogue/foo?size=3&colour=red&colour=green
then all foo
object with the attributes size
and colour
(that is bar
objects) are displayed if the size is 3 and the colour is either red or green.
Can this work?