Gavin Wiener
1 min readMar 10, 2020

--

Sacsham Agrawal There are no silly questions!

You do not have to copy the whole save function. A very important line in the save example I included is;

user = super(MyCustomSignForm, self).save(request)

This line calls the original form’s save function (the form we are extending). We are not overriding/redefining the original save function, we’re “adding” to it.

The ... in my example indicates there “may” be more fields or additional logic e.g. maybe we want to .upper() the organization name, maybe we want to include organization_country as well in our form but it is not required by the user model.

The reason I do not call .super() at the top is a bit specific to the project; my user model in this project has an organization foreign key, it is not just a string, so I had to first create the organization model instance.

I may mention this in the article thanks to your question!

--

--

Gavin Wiener
Gavin Wiener

Written by Gavin Wiener

I'm a coder and freelancer from South Africa with 5+ years experience in automations, integrations and API's using Python and Django.

No responses yet