Filtering model results for Django admin select box
- by blcArmadillo
I just started playing with Django today and so far am finding it rather difficult to do simple things. What I'm struggling with right now is filtering a list of status types. The StatusTypes model is:
class StatusTypes(models.Model):
status = models.CharField(max_length=50)
type = models.IntegerField()
def __unicode__(self):
return self.status
class Meta:
db_table = u'status_types'
In one admin page I need all the results where type = 0 and in another I'll need all the results where type = 1 so I can't just limit it from within the model. How would I go about doing this?