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.


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
> 
> .
>

-- 
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.


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
> 
> .
>

-- 
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-04 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.



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.



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
-~--~~~~--~~--~--~---