[Answered ]-Hidden form field using none model forms

2👍

Use forms.ModelForm to override the init

class YourForm(forms.ModelForm):
    amount = forms.FloatField() 

    def __init__(self, *args, **kwargs):
        super(YourForm, self).__init__(*args, **kwargs)
        self.fields['amount'].widget = forms.HiddenInput() 
        self.fields['amount'].initial = '' 

Leave a comment