[Django] #33116: 'str' object is not callable error appears from Django Message Framework

40 views
Skip to first unread message

Django

unread,
Sep 16, 2021, 11:21:51 PM9/16/21
to django-...@googlegroups.com
#33116: 'str' object is not callable error appears from Django Message Framework
--------------------------------------------+------------------------
Reporter: salima | Owner: nobody
Type: Bug | Status: new
Component: contrib.messages | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------------+------------------------
Our web application prompts confirmation messages when user submits the
form and users can continue to submit additional forms while they are
using application and the confirmation messages are prompted fine, but
'str' object is not callable error appears randomly before prompting a
confirmation message and once this error starts appearing it will continue
to appear for any form submission. During our testing we observed that
this issue is happening in Django version 3.2.7 (ubuntu 20.x), but it is
not reproducible in Django version 3.1.6 (windows10). So, we think that
this could be a bug in version 3.2.7 . We made sure our code by following
this page.

https://docs.djangoproject.com/en/3.2/ref/contrib/messages/

In views.py :

{{{
messages.success(request, "Item is successfully removed.")
}}}


In template:

{{{
{% for message in messages %}
<div class = "conf_body">
<div class="alert alert-{% if message.tags == 'error'
%}danger{% else %}{{ message.tags }}{% endif %} success-alert flex-row">
<a class="close close_conf" href="#" data-dismiss="alert"
style="">×</a>
{% if message.tags == 'error' %}
<i style="color:red;" class="fa fa-exclamation-circle
circle_post"
aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;
<span class = "conf_text" style="color:red;"
class="text_post">{{ message|safe }}&nbsp;&nbsp;</span>
{% else %}
<i style="color:#01ABAA;" class="fa fa-check-circle
circle_post " aria-hidden="true">&nbsp;</i>
<span class = "conf_text"
style="color:#01ABAA;">&nbsp;&nbsp;&nbsp;{{ message|safe
}}</span>&nbsp;&nbsp;
{% endif %}
</div>
</div>
{% endfor %}
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33116>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 17, 2021, 12:49:55 AM9/17/21
to django-...@googlegroups.com
#33116: 'str' object is not callable error appears from contrib.messages.
----------------------------------+--------------------------------------
Reporter: salima | Owner: nobody
Type: Bug | Status: closed
Component: contrib.messages | Version: 3.2
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => needsinfo


Comment:

Thanks for the report, however I don't think you've explained the issue in
enough detail to confirm a bug in Django. Please reopen the ticket if you
can debug your issue and provide details (traceback or/and a sample
project) about why and where Django is at fault. If you're having trouble
understanding how Django works, see
TicketClosingReasons/UseSupportChannels for ways to get help.

--
Ticket URL: <https://code.djangoproject.com/ticket/33116#comment:1>

Reply all
Reply to author
Forward
0 new messages