예제 #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['build'].queryset = Build.list_active(query)
예제 #2
0
 def populate(self, product_id=None):
     # 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?
     if product_id:
         self.fields['product_version'].queryset = Version.objects.filter(
             product__pk=product_id)
         self.fields['build'].queryset = Build.objects.filter(
             product__pk=product_id)
     else:
         self.fields['product_version'].queryset = Version.objects.all()
         self.fields['build'].queryset = Build.list_active()
예제 #3
0
파일: forms.py 프로젝트: jaydenxxx/Kiwi
 def populate(self, product_id):
     query = {'product_id': product_id}
     self.fields['build'].queryset = Build.list_active(query)