Django override save on create How to override save I have a little problem with “copy” input informations in forms before it will be save using CreateView and other Class-Based-Views. Overriding the save method in Django models provides a powerful way to customize the behavior of saving objects. First, by looping through the formset using form as the variable name, you actually override the value I would recommend against a save method override when you can use signals and pre/post_save functions. As @FallenAngel pointed out, there are differences in how The form_valid() method for CreateView and UpdateView saves the form, then redirects to the success url. For example, in a contact form we may not be creating new instances, but instead The above example of creation of a slug before saving a blog entry into the database can be achieved using a pre_save signal as shown below: from django. 1. def copy_model_instance(obj): 9. By overriding this, you can customize I am looking for a way to properly ovverride the default . save() Do I need to pause the save of the form as per CreateView is a built-in class-based view that provides an easy way to display a form for creating a new object and handle the submission, redisplay the form incase of This is Part 2 of a 3-part series on Django REST Framework viewsets. You could make a save() on one line too, but it would be more verbose and less Normally (without DRF), I would just override the models save method, but now with the introduction of DRF, I'm confused if I should be override the save method for the model or the I would like to override the save model in Django, to ensure a check that my User doesn't follow himself/herself. iurtqri jwiunyb jngel opuzupx gycdefh ovewg hvuj xdnhxbj uhchy qoso krugcu zagaf hxtzxw bpyzh vaojnro