Re: 'str' object is not callable

2022-05-06 Thread Lalit Suthar
this part of the code looks fine from a first look. Can you share the
complete view code for this

On Fri, 6 May 2022 at 12:11, Salima Begum 
wrote:

> Hi all,
> In my project I am Django messages Framework. I am always facing 'str'
> object error I dont understand how to solve this problem. Previously also I
> face same issue. Now it is reproduced.
> I am using django 4.0.4 version.
>  Python 3.9.6
> ```
>messages.success(request, "Welcome back")
> ```
> ```
> {% if messages %}
> {% for message in messages %}
> 
> 
>  style="">×
> {% if message.tags == 'error' %}
> aria-hidden="true">   
> {{
> message|safe }}  
> {% else %}
>  
>  style="color:#01ABAA;">   {{ message|safe
> }}  
> {% endif %}
> 
> 
> {% endfor %}
> {% endif %}
> ```
>
> Please help me to solve this issue.
>
> Thanks
> ~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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6bkPYRUwSidJd1ay-q-GdeM5Q8CKqY%2BnYU3j7wk%2BEAmYOQ%40mail.gmail.com
> 
> .
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFj6DZ74w_Fv1an8SwtoDReG7YseridBDJ1PScuKdwUoQ%40mail.gmail.com.


'str' object is not callable

2022-05-05 Thread Salima Begum
Hi all,
In my project I am Django messages Framework. I am always facing 'str'
object error I dont understand how to solve this problem. Previously also I
face same issue. Now it is reproduced.
I am using django 4.0.4 version.
 Python 3.9.6
```
   messages.success(request, "Welcome back")
```
```
{% if messages %}
{% for message in messages %}


×
{% if message.tags == 'error' %}
   
{{
message|safe }}  
{% else %}
 
   {{ message|safe
}}  
{% endif %}


{% endfor %}
{% endif %}
```

Please help me to solve this issue.

Thanks
~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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bkPYRUwSidJd1ay-q-GdeM5Q8CKqY%2BnYU3j7wk%2BEAmYOQ%40mail.gmail.com.


'str' object is not callable

2022-05-05 Thread Salima Begum
Hi all,
In my project I am Django messages Framework. I am always facing 'str'
object error I dont understand how to solve this problem. Previously also I
face same issue. Now it is reproduced.
I am using django 4.0.4 version.
 Python 3.9.6
```
   messages.success(request, "Welcome back")
```
```
{% if messages %}
{% for message in messages %}


×
{% if message.tags == 'error' %}
   
{{
message|safe }}  
{% else %}
 
   {{ message|safe
}}  
{% endif %}


{% endfor %}
{% endif %}
```

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bmF41eqWhxaXPG65TyDjNUzxfgYDxGSvSM9aiArfnxMMQ%40mail.gmail.com.


Re: 'str' object is not callable error appears from Django Message Framework

2021-09-20 Thread David Nugent
Hi Salima,

Stack trace?  Always the first call for triage on python exceptions.

Also (and unrelated to your issue) google "django messages bootstrap" and
check on how to avoid the  {% if message.tags == .. %} horror show and make
your templates much more readable/easily maintained.

On Mon, Sep 20, 2021 at 1:52 PM Salima Begum 
wrote:

> Hi all,
>
>
> 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 %}
> 
> 
>  style="">×
> {% if message.tags == 'error' %}
> aria-hidden="true">   
>  class="text_post">{{ message|safe }}  
> {% else %}
>  
>  style="color:#01ABAA;">   {{ message|safe
> }}  
> {% endif %}
> 
> 
> {% endfor %}
> }}}
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6b%3DJ2OLkOiwpRw2h6H48x6ELb61REWM%3Dj913pssxBZsrhA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMSz6b%3DJ2OLkOiwpRw2h6H48x6ELb61REWM%3Dj913pssxBZsrhA%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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE5VhgXBXzrEf1PNWbPqAjRLbj04gW8LoVkR5maZ%3D_8fKiF3Aw%40mail.gmail.com.


'str' object is not callable error appears from Django Message Framework

2021-09-19 Thread Salima Begum
Hi all,


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 %}


×
{% if message.tags == 'error' %}
   
{{ message|safe }}  
{% else %}
 
   {{ message|safe
}}  
{% endif %}


{% endfor %}
}}}

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3DJ2OLkOiwpRw2h6H48x6ELb61REWM%3Dj913pssxBZsrhA%40mail.gmail.com.


Re: TypeError: 'str' object is not callable

2021-09-13 Thread Salima Begum
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 
wrote:

> cool :)
>
>
> On Tue, 31 Aug 2021 at 11:27, Salima Begum 
> 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 
>> 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 
>>> 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 <
>>>> salim...@rohteksolutions.com> 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 <
>>>>> tlockhart1...@gmail.com> 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 <
>>>>>> salim...@rohteksolutions.com> 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 django-users+unsubscr...@googlegroups.com.
>>>>>> 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-NsPTR

Re: TypeError: 'str' object is not callable

2021-09-01 Thread Lalit Suthar
cool :)


On Tue, 31 Aug 2021 at 11:27, Salima Begum 
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 
> 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 
>> 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 <
>>> salim...@rohteksolutions.com> 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 <
>>>> tlockhart1...@gmail.com> 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 <
>>>>> salim...@rohteksolutions.com> 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 django-users+unsubscr...@googlegroups.com.
>>>>> 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 django-users+unsubscr...@googlegroups.com.
>>>>> 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 django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMSz6b%3Dgrd5PeypVZJQ9L9uA90_xxijiq6eQSaqH6bdqhgNukg%40mail.gmail.com
>&g

Re: TypeError: 'str' object is not callable

2021-08-30 Thread Salima Begum
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 
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 
> 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 <
>> salim...@rohteksolutions.com> 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 
>>> 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 
>>>> 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 django-users+unsubscr...@googlegroups.com.
>>>> 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 django-users+unsubscr...@googlegroups.com.
>>>> 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 django-users+unsubscr...@googlegroups.com.
>> 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 django-users+unsubscr...@googlegroups.com.
> 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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bmDkQio%3DYD9jxHxthnuupwkR80sjWgLEY4E6-SPZ5ofxQ%40mail.gmail.com.


Re: TypeError: 'str' object is not callable

2021-08-30 Thread Lalit Suthar
go like this

messages.add_message(request, messages.WARNING, "failure message")
return HttpResponse / render

On Tue, 31 Aug 2021 at 10:32, Salima Begum 
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 <
> salim...@rohteksolutions.com> 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 
>> 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 
>>> 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 django-users+unsubscr...@googlegroups.com.
>>> 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 django-users+unsubscr...@googlegroups.com.
>>> 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 django-users+unsubscr...@googlegroups.com.
> 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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVE6P_5qUAC2Ec%3D8Tzn6mUPTdvXhWJ4dO5XUUC2D-7vYVQ%40mail.gmail.com.


Re: TypeError: 'str' object is not callable

2021-08-30 Thread Salima Begum
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 
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 
> 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 
>> 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 django-users+unsubscr...@googlegroups.com.
>> 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 django-users+unsubscr...@googlegroups.com.
>> 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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3Dgrd5PeypVZJQ9L9uA90_xxijiq6eQSaqH6bdqhgNukg%40mail.gmail.com.


Re: TypeError: 'str' object is not callable

2021-08-30 Thread Salima Begum
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 
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 
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com
> 
> .
>
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com
> 
> .
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bnyEHFg6oV2M%2Be1pMvktqaKc8WqRRZwek7-WscekmrbOQ%40mail.gmail.com.


Re: TypeError: 'str' object is not callable

2021-08-30 Thread Jacob Greene
You need to pass the request object as the first argument.

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

On Mon, Aug 30, 2021, 11:01 PM Thomas Lockhart 
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 
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com
> 
> .
>
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com
> 
> .
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF-Y%3De6zk%2BS4V0bCSgyN678hby%2BXAkTT66h5rH80_LKj1e0WXw%40mail.gmail.com.


Re: TypeError: 'str' object is not callable

2021-08-30 Thread Thomas Lockhart
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  
> 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 django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com
>  
> .

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com.


TypeError: 'str' object is not callable

2021-08-30 Thread Salima Begum
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com.


Re: 'str' object is not callable

2020-09-23 Thread Khaleel Ahmed H. M. Shariff
Hi,
May Peace, Blessings & Mercy of Almighty God be on you!
The reason for 'str' object is not callable is because you have created a
string object & given parenthesis along with it. As is,
>>> x="Good Morning"
>>> x()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'str' object is not callable
>>>
[image: image.png]
Hope this helps.

Thanks in advance.


God Bless You!
God Bless India!!
--

Love & Regards
Dr. (h.c.) Khaleel Ahmed H. M.

Managing Director, Tanzanite Realty India Private Limited

---

Human Life is Precious
Koran Surah Ma'idah Chapter 5 Verse 32:
If anyone killed a person, not in retaliation of murder, or (and) to spread
mischief in the land - it would be as if he killed all mankind, & if anyone
saved a life, it would be as if he saved the life of all mankind.


On Wed, Sep 23, 2020 at 9:24 PM Salima Begum 
wrote:

> Hi all,
>
> I am getting this error. May I know the reason why this error occurred?
>
> Here I attached two screenshots please review and let me know.
>
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6b%3DgkYNkLXb6foQWr-vO5ZeU%3Draix-wp2rCNU3_eO2BxEg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMSz6b%3DgkYNkLXb6foQWr-vO5ZeU%3Draix-wp2rCNU3_eO2BxEg%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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMjBbiBPARJURPstmP1WZM8O_tKz3ks0%2B0wH%3DxVcbTc8zi__4A%40mail.gmail.com.


Re: 'str' object is not callable

2020-09-23 Thread Alam Khazi
Thank you I will try that.

On Wed 23 Sep, 2020, 9:38 PM Avi shah,  wrote:

> Try adding ''' as it can only take one string as parameter , ''' ''your
> message'' . '' your message 2 '' '''
>
> On Wed, Sep 23, 2020 at 9:24 PM Salima Begum 
> wrote:
>
>> Hi all,
>>
>> I am getting this error. May I know the reason why this error occurred?
>>
>> Here I attached two screenshots please review and let me know.
>>
>> 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 django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMSz6b%3DgkYNkLXb6foQWr-vO5ZeU%3Draix-wp2rCNU3_eO2BxEg%40mail.gmail.com
>> 
>> .
>>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALa7AFMcbvsLjdKDqquKw6YKiikDDyqTQEBjcNGY_fmFnVGf%2BA%40mail.gmail.com
> 
> .
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABscGkRc-3FJeBs9vtHoWcvbbOD7xA5r15DdmHZCXktcfcGRkw%40mail.gmail.com.


Re: 'str' object is not callable

2020-09-23 Thread Avi shah
Try adding ''' as it can only take one string as parameter , ''' ''your
message'' . '' your message 2 '' '''

On Wed, Sep 23, 2020 at 9:24 PM Salima Begum 
wrote:

> Hi all,
>
> I am getting this error. May I know the reason why this error occurred?
>
> Here I attached two screenshots please review and let me know.
>
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6b%3DgkYNkLXb6foQWr-vO5ZeU%3Draix-wp2rCNU3_eO2BxEg%40mail.gmail.com
> 
> .
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALa7AFMcbvsLjdKDqquKw6YKiikDDyqTQEBjcNGY_fmFnVGf%2BA%40mail.gmail.com.


Re: 'str' object is not callable in base.py

2012-09-04 Thread Lachlan Musicman
On Wednesday, September 5, 2012, Bill Freeman wrote:

> My best guess is that, for whatever reason, 'timetable_view' in your url
> conf
> has not been converted into the view function.  Try actually importing the
> view in urls.py and putting it as the target of the pattern *without*
> the quotes.
> If this works, then figuring out whether you needed
> 'app_name.timetable_view'
> or some such is where to look.  If it still doesn't work, you may get
> additional
> insights (can you actually import views.py, or does it have a syntax
> error, etc.).


Yes, this was the answer - thanks Bill.

I tried tafe.timetable_view and it didn't work, so I tried

from tafe.views import timetable_view

and it did...

then I realised I needed

'tafe*.views.*.timetable_view'
 as the pattern target.

Thanks for your help
L.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 'str' object is not callable in base.py

2012-09-04 Thread Lachlan Musicman
On Tuesday, September 4, 2012, zayatzz wrote:

> From this post i can see this line beeing wrong .
>
> timetable = get_object_or_404(slug=slug)
>
> You also need to give object as one of the parameters for
> get_object_or_404 shortcut: like this :
>
> https://docs.djangoproject.com/en/dev/intro/tutorial03/?from=olddocs#a-shortcut-get-object-or-404
>

Thankyou for pointing this out - it was indeed wrong and has now been
fixed. Unfortunately, it didn't solve the problem.

cheers
L.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 'str' object is not callable in base.py

2012-09-04 Thread Bill Freeman
My best guess is that, for whatever reason, 'timetable_view' in your url conf
has not been converted into the view function.  Try actually importing the
view in urls.py and putting it as the target of the pattern *without*
the quotes.
If this works, then figuring out whether you needed 'app_name.timetable_view'
or some such is where to look.  If it still doesn't work, you may get additional
insights (can you actually import views.py, or does it have a syntax
error, etc.).

On Tue, Sep 4, 2012 at 2:06 AM, zayatzz  wrote:
> From this post i can see this line beeing wrong .
>
> timetable = get_object_or_404(slug=slug)
>
> You also need to give object as one of the parameters for get_object_or_404
> shortcut: like this :
> https://docs.djangoproject.com/en/dev/intro/tutorial03/?from=olddocs#a-shortcut-get-object-or-404
>
> Alan
>
>
> On Tuesday, September 4, 2012 7:30:22 AM UTC+3, Lachlan Musicman wrote:
>>
>> Hi all,
>>
>> Stumped on this one:
>>
>>
>> Traceback:
>>
>> Environment:
>>
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/tafe/timetable/2012-4/
>>
>> Django Version: 1.4
>> Python Version: 2.7.3
>> Installed Applications:
>> ('django.contrib.auth',
>>  'django.contrib.contenttypes',
>>  'django.contrib.sessions',
>>  'django.contrib.sites',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'django.contrib.admin',
>>  'tafe',
>>  'south',
>>  'crispy_forms')
>> Installed Middleware:
>> ('django.middleware.common.CommonMiddleware',
>>  'django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.csrf.CsrfViewMiddleware',
>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>  'django.contrib.messages.middleware.MessageMiddleware')
>>
>> Traceback:
>> File
>> "/home/datakid/src/envs/mlhrd/local/lib/python2.7/site-packages/django/core/handlers/base.py"
>> in get_response
>>   111. response = callback(request,
>> *callback_args, **callback_kwargs)
>>
>> Exception Type: TypeError at /tafe/timetable/2012-4/
>> Exception Value: 'str' object is not callable
>>
>> urls.py:
>> ...
>>   url(r'^timetable/(?P[-\w]+)/$', 'timetable_view'),
>> ...
>>
>> views.py:
>> @login_required
>> def timetable_view(request, slug):
>> timetable = get_object_or_404(slug=slug)
>> sessions = timetable.sessions.all()
>> return
>> render_to_response('tafe/timetable_detail.html',{'timetable':timetable,'sessions':sessions})
>>
>> models.py:
>>
>> class Session(models.Model):
>>...
>>timetable = models.ForeignKey(Timetable, related_name='sessions')
>>...
>>
>> What am I doing wrong?
>>
>> cheers
>> L.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/gEKT5Z85E14J.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 'str' object is not callable in base.py

2012-09-03 Thread zayatzz
>From this post i can see this line beeing wrong . 

timetable = get_object_or_404(slug=slug) 

You also need to give object as one of the parameters for get_object_or_404 
shortcut: like this :
https://docs.djangoproject.com/en/dev/intro/tutorial03/?from=olddocs#a-shortcut-get-object-or-404

Alan

On Tuesday, September 4, 2012 7:30:22 AM UTC+3, Lachlan Musicman wrote:
>
> Hi all, 
>
> Stumped on this one: 
>
>
> Traceback: 
>
> Environment: 
>
> Request Method: GET 
> Request URL: http://127.0.0.1:8000/tafe/timetable/2012-4/ 
>
> Django Version: 1.4 
> Python Version: 2.7.3 
> Installed Applications: 
> ('django.contrib.auth', 
>  'django.contrib.contenttypes', 
>  'django.contrib.sessions', 
>  'django.contrib.sites', 
>  'django.contrib.messages', 
>  'django.contrib.staticfiles', 
>  'django.contrib.admin', 
>  'tafe', 
>  'south', 
>  'crispy_forms') 
> Installed Middleware: 
> ('django.middleware.common.CommonMiddleware', 
>  'django.contrib.sessions.middleware.SessionMiddleware', 
>  'django.middleware.csrf.CsrfViewMiddleware', 
>  'django.contrib.auth.middleware.AuthenticationMiddleware', 
>  'django.contrib.messages.middleware.MessageMiddleware') 
>
> Traceback: 
> File 
> "/home/datakid/src/envs/mlhrd/local/lib/python2.7/site-packages/django/core/handlers/base.py"
>  
>
> in get_response 
>   111. response = callback(request, 
> *callback_args, **callback_kwargs) 
>
> Exception Type: TypeError at /tafe/timetable/2012-4/ 
> Exception Value: 'str' object is not callable 
>
> urls.py: 
> ... 
>   url(r'^timetable/(?P[-\w]+)/$', 'timetable_view'), 
> ... 
>
> views.py: 
> @login_required 
> def timetable_view(request, slug): 
> timetable = get_object_or_404(slug=slug) 
> sessions = timetable.sessions.all() 
> return 
> render_to_response('tafe/timetable_detail.html',{'timetable':timetable,'sessions':sessions})
>  
>
>
> models.py: 
>
> class Session(models.Model): 
>... 
>timetable = models.ForeignKey(Timetable, related_name='sessions') 
>... 
>
> What am I doing wrong? 
>
> cheers 
> L. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/gEKT5Z85E14J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



'str' object is not callable in base.py

2012-09-03 Thread Lachlan Musicman
Hi all,

Stumped on this one:


Traceback:

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/tafe/timetable/2012-4/

Django Version: 1.4
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'tafe',
 'south',
 'crispy_forms')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')

Traceback:
File 
"/home/datakid/src/envs/mlhrd/local/lib/python2.7/site-packages/django/core/handlers/base.py"
in get_response
  111.                 response = callback(request,
*callback_args, **callback_kwargs)

Exception Type: TypeError at /tafe/timetable/2012-4/
Exception Value: 'str' object is not callable

urls.py:
...
  url(r'^timetable/(?P[-\w]+)/$', 'timetable_view'),
...

views.py:
@login_required
def timetable_view(request, slug):
timetable = get_object_or_404(slug=slug)
sessions = timetable.sessions.all()
return 
render_to_response('tafe/timetable_detail.html',{'timetable':timetable,'sessions':sessions})

models.py:

class Session(models.Model):
   ...
   timetable = models.ForeignKey(Timetable, related_name='sessions')
   ...

What am I doing wrong?

cheers
L.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: RE: 'str' object is not callable

2011-02-18 Thread Burhan
Where is 'deletion_time' defined, in reference to the urls.py? The error is 
that urls.py can't resolve deletion_time, which is why its saying that "I 
cannot call a string object".

I would investigate that.  Try qualifying it by giving it the module name.

On another note, you can concatenate your two statements in your method to 
Buchung.object.filter(id=obj_id).delete()

Hope this helps.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: 'str' object is not callable

2011-02-16 Thread Chris Matthews
Hi Patrick,



You can typically get it by:

1)missing the % for a string format:

  x = "Hello number %d" (5)

  TypeError: 'str' object is not callable



2) And if you overwrite a function name with a string, e.g."

>>> min(5,2,3)

2



>>> hour,min,sec = "14:59:03".split(":")

>>> min(5,2,3)

TypeError: 'str' object is not callable



Just check your recent code.



Regards

Chris



-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Szabo, Patrick (LNG-VIE)
Sent: 16 February 2011 14:03
To: django-users@googlegroups.com
Subject: 'str' object is not callable



Hi,



Im getting 'str' object is not callable and i have no idea why.

What I'm doing is the following:



delete



buchung is a list and the 6th element oft hat list is an object with an

attribute id.



In my urls.py i did this:



(r'deletion_time/(?P\d+)/$', 'deletion_time'),



And the view looks like this:



def deletion_time(request, obj_id):

buchung = Buchung.object.filter(id = obj_id)

buchung.delete()

return HttpResponseRedirect('/main/')



Can anyone tell me what's causing this error ?!



Kind regards



. . . . . . . . . . . . . . . . . . . . . . . . . .

Patrick Szabo

 XSLT-Entwickler

LexisNexis

Marxergasse 25, 1030 Wien



mailto:patrick.sz...@lexisnexis.at

Tel.: +43 (1) 534 52 - 1573

Fax: +43 (1) 534 52 - 146











--

You received this message because you are subscribed to the Google Groups 
"Django users" group.

To post to this group, send email to django-users@googlegroups.com.

To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.

For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



'str' object is not callable

2011-02-16 Thread Szabo, Patrick (LNG-VIE)
Hi, 

Im getting 'str' object is not callable and i have no idea why. 
What I'm doing is the following:

delete

buchung is a list and the 6th element oft hat list is an object with an
attribute id.

In my urls.py i did this:

(r'deletion_time/(?P\d+)/$', 'deletion_time'),

And the view looks like this:

def deletion_time(request, obj_id):
buchung = Buchung.object.filter(id = obj_id)
buchung.delete()
return HttpResponseRedirect('/main/')

Can anyone tell me what's causing this error ?!

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 'str' object is not callable

2009-08-03 Thread Malcolm Tredinnick

On Mon, 2009-08-03 at 09:51 -0700, Dolph wrote:
> hey Ronghui,
> 
> Thanks for the reply. I couldnt get your first suggestion to work, I
> get "name 'coltrane_category_detail' is not defined". Also,

Which is exactly what the problem is. In the first email you posted, you
don't have any view called coltrane_category_detail. You do have one
called category_detail that is in the coltrane module, so you might be
intending to write coltrane.category_detail, or maybe you mean something
else.

In any case, the error message is correct: the function you are trying
to dispatch to does not exist.

Regards,
Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 'str' object is not callable

2009-08-03 Thread Dolph

hey Ronghui,

Thanks for the reply. I couldnt get your first suggestion to work, I
get "name 'coltrane_category_detail' is not defined". Also,

Also, I never posted my models.py in my Category class,
get_absolute_url:

def get_absolute_url(self):
return ('coltrane_category_detail', (), {'slug': self.slug})

Perhaps I'm doing something wrong here? Could it be the way that I'm
passing the values?

On Aug 2, 7:44 pm, Ronghui Yu  wrote:
> Try to configure url from
> (r'^(?P[-\w]+)/$', 'coltrane_category_detail'),
>
> to
>
> (r'^(?P[-\w]+)/$', coltrane_category_detail),
>
> But before that, you need to import this function
>
> Or
>
> give a whole path to the view like
>
> (r'^(?P[-\w]+)/$', 'pack_xxx.mod_xxx.coltrane_category_detail'),
>
>
>
> On Mon, Aug 3, 2009 at 2:00 AM, Dolph  wrote:
>
> > hey guys,
>
> > New to django and I'm just working through James Bennett's practical
> > django projects book, 2nd ed. I'm trying to get the categories section
> > working in the blog and I'm getting the above error. I've read through
> > some of the previous posts to try to figure it out, but I can't seem
> > to figure it out.
>
> > error:
>
> > /usr/lib/python2.5/site-packages/django/core/handlers/base.py in
> > get_response, line 86
>
> > categories.py in urls directory:
>
> > from django.conf.urls.defaults import *
>
> > from coltrane.models import Category
>
> > urlpatterns = patterns('',
> >        (r'^$','django.views.generic.list_detail.object_list',
> >            { 'queryset': Category.objects.all() }),
> >        (r'^(?P[-\w]+)/$', 'coltrane_category_detail'),
> > )
>
> > here's my view in coltrane:
>
> > from django.shortcuts import get_object_or_404
> > from coltrane.models import Category
> > from django.views.generic.list_detail import object_list
>
> > def category_detail(request, slug):
> >    category = get_object_or_404(Category, slug=slug)
> >    return object_list(request, queryset=category.entry_set.all(),
> >            extra_context={ 'category': category })
>
> > the category list works ok and the get_absolute_url is rendering the
> > correct link, but when I click on the link or attempt to get specific
> > category details, i.e. "http://127.0.0.1:8000/weblog/categories/
> > programming/", I get the above error.
>
> > thanks.
>
> > Eric
>
> --
> ===
> Regards
> Ronghui Yu
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 'str' object is not callable

2009-08-02 Thread Ronghui Yu
Try to configure url from
(r'^(?P[-\w]+)/$', 'coltrane_category_detail'),

to

(r'^(?P[-\w]+)/$', coltrane_category_detail),

But before that, you need to import this function

Or

give a whole path to the view like

(r'^(?P[-\w]+)/$', 'pack_xxx.mod_xxx.coltrane_category_detail'),

On Mon, Aug 3, 2009 at 2:00 AM, Dolph  wrote:

>
> hey guys,
>
> New to django and I'm just working through James Bennett's practical
> django projects book, 2nd ed. I'm trying to get the categories section
> working in the blog and I'm getting the above error. I've read through
> some of the previous posts to try to figure it out, but I can't seem
> to figure it out.
>
> error:
>
> /usr/lib/python2.5/site-packages/django/core/handlers/base.py in
> get_response, line 86
>
> categories.py in urls directory:
>
> from django.conf.urls.defaults import *
>
> from coltrane.models import Category
>
> urlpatterns = patterns('',
>(r'^$','django.views.generic.list_detail.object_list',
>{ 'queryset': Category.objects.all() }),
>(r'^(?P[-\w]+)/$', 'coltrane_category_detail'),
> )
>
> here's my view in coltrane:
>
> from django.shortcuts import get_object_or_404
> from coltrane.models import Category
> from django.views.generic.list_detail import object_list
>
> def category_detail(request, slug):
>category = get_object_or_404(Category, slug=slug)
>return object_list(request, queryset=category.entry_set.all(),
>extra_context={ 'category': category })
>
> the category list works ok and the get_absolute_url is rendering the
> correct link, but when I click on the link or attempt to get specific
> category details, i.e. "http://127.0.0.1:8000/weblog/categories/
> programming/", I get the above error.
>
> thanks.
>
> Eric
>
> >
>


-- 
===
Regards
Ronghui Yu

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



'str' object is not callable

2009-08-02 Thread Dolph

hey guys,

New to django and I'm just working through James Bennett's practical
django projects book, 2nd ed. I'm trying to get the categories section
working in the blog and I'm getting the above error. I've read through
some of the previous posts to try to figure it out, but I can't seem
to figure it out.

error:

/usr/lib/python2.5/site-packages/django/core/handlers/base.py in
get_response, line 86

categories.py in urls directory:

from django.conf.urls.defaults import *

from coltrane.models import Category

urlpatterns = patterns('',
(r'^$','django.views.generic.list_detail.object_list',
{ 'queryset': Category.objects.all() }),
(r'^(?P[-\w]+)/$', 'coltrane_category_detail'),
)

here's my view in coltrane:

from django.shortcuts import get_object_or_404
from coltrane.models import Category
from django.views.generic.list_detail import object_list

def category_detail(request, slug):
category = get_object_or_404(Category, slug=slug)
return object_list(request, queryset=category.entry_set.all(),
extra_context={ 'category': category })

the category list works ok and the get_absolute_url is rendering the
correct link, but when I click on the link or attempt to get specific
category details, i.e. "http://127.0.0.1:8000/weblog/categories/
programming/", I get the above error.

thanks.

Eric

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



'str' object is not callable - Changing Form object in a view

2007-08-24 Thread Tipan

I have a series of on-line questionnaires, each has a separate Form
class defined because the question types and data types for the
responses are always different.

I'd like to be able to set the form that is used in the view based on
an ID parameter passed to the view. However, whatever I try, I end up
with a 'str' object is not callable.

My workround for the time being is a very inefficient if/elif case
based selection process, but it requires modifying the view each time
we create another questionnaire - very clumsy.

Can anyone suggest a way to dynamically set my form objects within the
view?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---