obj.save()
messages.success(request,'{} is successfully updated'.format(obj.template_name))
here the obj.save() saves all the changes in database. and then I am printing my custom message after it.
obj.save()
messages.success(request,'{} is successfully updated'.format(obj.template_name))
here the obj.save() saves all the changes in database. and then I am printing my custom message after it.
def message_user(self, request, message, level=messages.INFO, extra_tags='',
fail_silently=False):
pass
def save_model(self, request, obj, form, change):
try:
/some code
except:
/some code
obj.save()
messages.success(request,'{} is successfully updated'.format(obj.template_name))
pass
This code should be in admin.py in the form class which you are trying to change. Here we are overriding the message_user function which sends message to user using django.contrib.messages and we are adding our own custom message after saving the obj.
Thanks @Vladimir Godovalov - How to prevent "Changed successfully" message when overriding save_model method