Hi, In my project for success confirmation messages I am using the Messages framework from Django. Here I am always getting errors in deployment server.
https://docs.djangoproject.com/en/3.2/ref/contrib/messages/ After deploying site.when i am continuously testing site. After some time I am getting the 'str' object is not callable error is raised. for success confirmation messages. In views.py we are defining confirmation messages. ``` messages.success(request, "Item is successfully removed.") ``` In settings.py ``` MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage' MESSAGE_LEVEL = message_constants.DEBUG ``` Django version 3.2.7 Can anyone please help me. how to fix this error I am facing this issue from long time back again and again same issue is raising. where I am going wrong i am not understanding could you please help me to fix this issue. Thanks ~Salima On Thu, Sep 2, 2021 at 10:27 AM Lalit Suthar <[email protected]> wrote: > cool :) > > > On Tue, 31 Aug 2021 at 11:27, Salima Begum <[email protected]> > wrote: > >> Hi all, >> Actually this error is prompting because in my deployment site I am using >> django version 3.2. In this version they have some issue with messages so, >> I referred to this document and I fixed it by adding one line in the >> settings.py file. >> https://docs.djangoproject.com/en/3.2/ref/contrib/messages/ >> >> On Tue, Aug 31, 2021 at 11:22 AM Lalit Suthar <[email protected]> >> wrote: >> >>> go like this >>> >>> messages.add_message(request, messages.WARNING, "failure message") >>> return HttpResponse / render >>> >>> On Tue, 31 Aug 2021 at 10:32, Salima Begum <[email protected]> >>> wrote: >>> >>>> Hi, Thank you for your response. >>>> I have defined as below I have mentioned snippet in all >>>> functionalities i am getting error in every functionality " 'str' object >>>> is not callable ".Please help me to fix this issue. >>>> >>>> ``` >>>> messages.success(request, """Your Ad is successfully posted.""") >>>> ``` >>>> Thank you >>>> ~Salima >>>> >>>> On Tue, Aug 31, 2021 at 10:19 AM Salima Begum < >>>> [email protected]> wrote: >>>> >>>>> Hi Thomas, >>>>> >>>>> The way I defined how i have written code for confirmation message >>>>> ``` >>>>> messages.success(request, """Your Ad is successfully >>>>> posted.""") >>>>> ``` >>>>> Thank you >>>>> ~Salima >>>>> >>>>> On Tue, Aug 31, 2021 at 9:31 AM Thomas Lockhart < >>>>> [email protected]> wrote: >>>>> >>>>>> Just guessing that you need to write >>>>>> >>>>>> messages.success = “Your ad is successfully posted” >>>>>> >>>>>> But without more information from you that is only a guess. >>>>>> >>>>>> How is messages.success defined? >>>>>> >>>>>> - Tom >>>>>> >>>>>> On Aug 30, 2021, at 8:57 PM, Salima Begum < >>>>>> [email protected]> wrote: >>>>>> >>>>>> Hi all, >>>>>> In my project for each functionality I have written code for >>>>>> confirmation messages. For example >>>>>> ``` >>>>>> messages.success("Your ad is successfully posted") >>>>>> ``` >>>>>> Every functionality is breaking because of confirmation messages >>>>>> after deployment. How to fix it? Can anyone help me? >>>>>> >>>>>> Thank you >>>>>> ~Salima >>>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Django users" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com >>>>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Django users" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com >>>>>> <https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Django users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/django-users/CAMSz6b%3Dgrd5PeypVZJQ9L9uA90_xxijiq6eQSaqH6bdqhgNukg%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/django-users/CAMSz6b%3Dgrd5PeypVZJQ9L9uA90_xxijiq6eQSaqH6bdqhgNukg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/CAGp2JVE6P_5qUAC2Ec%3D8Tzn6mUPTdvXhWJ4dO5XUUC2D-7vYVQ%40mail.gmail.com >>> <https://groups.google.com/d/msgid/django-users/CAGp2JVE6P_5qUAC2Ec%3D8Tzn6mUPTdvXhWJ4dO5XUUC2D-7vYVQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CAMSz6bmDkQio%3DYD9jxHxthnuupwkR80sjWgLEY4E6-SPZ5ofxQ%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CAMSz6bmDkQio%3DYD9jxHxthnuupwkR80sjWgLEY4E6-SPZ5ofxQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAGp2JVEm1-ACQdcQ4udBKVU1wEOY3yndsc0EKmYon9ukAQUGzA%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAGp2JVEm1-ACQdcQ4udBKVU1wEOY3yndsc0EKmYon9ukAQUGzA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMSz6bm4VcRDOp6HW0mDZAA8VwUCnxknBpw2sHvrgtV%3DZs47Zg%40mail.gmail.com.

