Thursday, September 13, 2012

Re: get_absolute_url is returning '' instead of url

On Fri, Sep 14, 2012 at 10:47 AM, Lachlan Musicman <datakid@gmail.com> wrote:
>> How do I call reverse in the shell? Import it and...?
>>
>> reverse(s)?
>
> Gah, should have tried that before sending:
>
>>>> from django.core.urlresolvers import reverse
>>>> reverse(s)
> Traceback (most recent call last):
> File "<console>", line 1, in <module>
> File "/home/datakid/src/envs/mlhrd/local/lib/python2.7/site-packages/django/core/urlresolvers.py",
> line 476, in reverse
> return iri_to_uri(resolver._reverse_with_prefix(view, prefix,
> *args, **kwargs))
> File "/home/datakid/src/envs/mlhrd/local/lib/python2.7/site-packages/django/core/urlresolvers.py",
> line 362, in _reverse_with_prefix
> raise NoReverseMatch("Error importing '%s': %s." % (lookup_view, e))
> NoReverseMatch: Error importing 'Friday, Morning 2, Mechanical Tools':
> 'Session' object has no attribute 'rindex'.
>
> Ok, we are getting somewhere....but google doesn't turn up anything
> that I understand/looks applicable?

What's the value of "s" that you're passing to reverse? Reverse takes
the same arguments as the return value of get_absolute_url() -- i.e.,
a string URL label, plus a dictionary of kwargs:

>>> reverse('my-url-name', kwargs={'arg1': 'value1'})

The error you're reporting looks like you're passing something other
than a string into reverse.

Yours,
Russ Magee %-)

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate