django - model form with 'helper select'
I'm looking for best solution for this issue:
I'have a Model like this:
class annotation(models.Model):
product = models.ForeignKey(Product, ... )
annotation = models.TextField( ...
A form for this Model may be:
product: [ a select to chose a product ]
annotations: [ a input type text ]
But, because product table is big, I show a previous select to user:
product family: [ a select to chose a product family ]
product: [ a select to chose a product in selected product family ]
annotations: [ a input type text ]
(Product family is another model and product has a foreign开发者_开发知识库 key to it)
My first solution was to write a new widget called SelectAjax and use it on ModelChoiceField. It works fine, but is not an elegant solution for me.
Can someone propose an alternative?
精彩评论