4👍
You can use your own forms, but it is better to use django forms because it provides more customization and flexibility.
It is easy to change the type of “widget” rendered with very little code change when you use django forms.
For example:
class MyForm(forms.Form):
my_field = forms.ChoiceField(choices=CHOICES) #choices can be a tuple
Would render as a checkbox field.
If you want to render the same as a Radio button, all you would have to do is:
class MyForm(forms.Form):
my_field = forms.ChoiceField(widget=forms.RadioSelect, choices=CHOICES)
You would have to manually change the entire code if you have your own form.
You can also do some custom field level validation on the server side in one pass (Example, check if username is unique) – You can achieve the same in a custom form, but you will have to handle every scenario yourself.
Also, django has ModelForms
which would be a replica of the Model object – that tremendously reduces the amount of work that needs to be done for validation, and form processing.