コード例 #1
0
 def populate(self, product_id):
     # We can dynamically set choices for a form field:
     # Seen at: http://my.opera.com/jacob7908/blog/2009/06/19/
     #          django-choicefield-queryset (Chinese)
     # Is this documented elsewhere?
     query = {'product_id': product_id}
     self.fields['product_version'].queryset = Version.objects.filter(
         product__id=product_id)
     self.fields['build'].queryset = TestBuild.list_active(query)