django admin filter foregein key

18 views
Skip to first unread message

Mariano DAngelo

unread,
Jan 18, 2013, 8:53:54 AM1/18/13
to django...@googlegroups.com
What I'm trying to do is to filter a dropdown list with foregein key, with the value of a previus selected dropdown list:

cat_choices = (('AMA','Amateur Mayores'),('AJ','Amateur Juveniles'),('AME','Amateur Menores'),('P','Profesional'))    

class category(models.Model):
    name = models.CharField('Categoria', max_length=30)
    gender = models.CharField('Sexo',choices= (('M','Masculino'),('F','Femenino')), max_length=1)
    type = models.CharField('Tipo',choices=cat_choices , max_length=3)
    
class boxer (person):
    gender = models.CharField('Sexo',choices= (('m','Masculino'),('F','Femenino')), max_length=30)
    type = models.CharField('Tipo',choices=cat_choices, max_length=30)
    category = models.ForeignKey(category)
  
    
I need to filter categories in boxer admin with the value of gender, and type choose in boxer admin.... I was going to do it with js but I wanted to know if the something already done...

thanks
Reply all
Reply to author
Forward
0 new messages