On Tue, Nov 24, 2009 at 4:49 PM, Tim Valenta <tonightslasts...@gmail.com>wrote:

> Ever since day one, I've never had a firm grasp on what the heck URL
> reversing can do.  I understand the concepts involved, even the admin
> namespacing that can occur with different admin sites, and I know that
> the admin uses it regularly, but it seems like a crazy unpredictable
> wildcard when I try to use it manually.
>
> For instance, I'm trying to get the permalink decorator to work on a
> "get_absolute_url()" method on my model, and I haven't got the
> slightest clue what the hell it's doing.  I'm getting errors about it
> not being able to reverse it properly when I try to click on the admin-
> generated "View on site ->" link from the change form.  It says that
> it can't find the view.
>
> Basically, I've tried making the method refer to the view object, a
> view name as a string (explicitly setting the name in the url conf),
> an absolute module-path string ("myproject.myapp.views.my_view"), and
> nothing works.  It can never find it, even on a view with just a
> single required keyword argument.
>
> Is there any amazing breakdown on how to better wrap my brain around
> how this url reversing thing works?  I typically don't think of myself
> as an idiot, but I really cannot even begin to feel like I can use it
> proficiently.
>
>
I could point you to the doc (
http://docs.djangoproject.com/en/dev/ref/models/instances/#the-permalink-decorator)
but it sounds like you have already read that.

Alternatively I could try to explain the errors you are getting for the
various things you have tried, but there aren't enough specifics here to do
that.  Spell out the URLConf info, exactly what you have tried for the
permalink/ger_abosolute_url code, and exactly what the error is, and someone
can likely help.

I'm assuming you are getting NoReverseMatch and that's what you mean when
you say "It says that it can't find the view"?  Those can be frustrating to
debug, but they tend be right and mean exactly what they say: given the
URLConf in place, there is no URL pattern in there that would result in the
specified view being called with the noted parameters.  The trick then is to
figure out why, since clearly you're expecting the URLConf to contain a
pattern that would result in that view being called with those
parameters....but without specifics on what you're trying it's hard to say
what, exactly, is going wrong with what you are trying.

Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.


Reply via email to