1π
β
I got exactly this same message when I accidentally used the messages
framework incorrectly in the form_valid
method of a completely different view in my project.
The correct code should have been:
messages.success(request, "Deactivated product")
But what I had written instead was
messages.success = "Deactivated product"
This code doesnβt work, but it doesnβt cause an error on the page, either! However, as soon as I submitted a different form that used the SuccessMessageMixin
, I would see the 'str' object is not callable
error.
(Having a problem on one page cause an error on a completely different page was fun to debug.)
Source:stackexchange.com