Thursday, September 13, 2012

Re: get_absolute_url is returning '' instead of url

On Fri, Sep 14, 2012 at 9:07 AM, Lachlan Musicman <datakid@gmail.com> wrote:
> Hi,
>
> I'm getting blank get_absolute_url problems that I just can't solve. I
> can get to an object by actually visiting the url that would be
> constructed - I've checked that: app/session/year/month/day/slug

> And the view seems to be properly constructed - I've got debug on, and
> I'm getting the page I expected rendering. It's only the
> get_absolute_url that's coming back blank.

Something is going wrong in the reversing process, which is raising an
exception, which is silently swallowed by the get_absolute_url call.
The usual culprit is that either the URL pattern isn't matching what
you think, or the object values you're passing into the reversal
process aren't what you think they are.

My suggestion -- open up a shell, and try making manual calls to
reverse(). This will show you whether the problem is with the URL
pattern, or with the data from the object.

Next step; put some debug into get_absolute_url itself -- make a
manual call to reverse inside get_absolute_url, and catch/print any
exception that is raised.

Hopefully, that should give you enough detail as to the source of the problem.

Russ %-)

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