dynamic formulas python django

1

I'm developing a project that needs to have a form created by the size of the item quantity that is created on another form. The initial form is FormRota:

    class FormRota(forms.ModelForm):
        researcher =forms.ModelChoiceField(queryset=Profile.objects.all(), widget=forms.Select(attrs={'class':'form-control'}) )
   establishment=forms.ModelChoiceField(queryset=Establishment.objects.all(), widget=forms.Select(attrs={'class':'form-control'}))
        product_to_search = forms.ModelMultipleChoiceField(queryset=Product.objects.all(), widget=forms.CheckboxSelectMultiple(attrs={'class':'checkbox-inline'}))
        date = forms.DateField(label='Data do registro', widget=forms.DateInput(attrs={'class': 'form-control', 'placeholder': 'Data de entrada de dados'}))

Let the other form search you:

class FormSeach(forms.ModelForm):
    class Meta:
        model = Seach
        fields = ['rout', 'price_product']

The price_product field must be created by the size of the product_to_search that is in FormRota.

Can anyone help me, how do I create fields dynamically in forms? The version I use is 1.3 from Django!

Thank you!

    
asked by anonymous 10.10.2016 / 21:44

0 answers