1👍
You can use update_or_create.
A convenience method for updating an object with the given kwargs, creating a new one if necessary.
obj, created = User.objects.update_or_create(email='foo@bar.com', name='foo', salary=100)
Refer this https://docs.djangoproject.com/en/3.1/ref/models/querysets/#update-or-create
Source:stackexchange.com