You want something like this

@models.permalink
def get_absolute_url(self):
     return ('orgs.views.org', [self.type.slug, self.slug])

Essentially, you code would be doing something like reverse('/org/
hoa/', kwargs={..}) which fails. Templates supress Exceptions so you
do not see them.


On Oct 27, 9:48 pm, bobhaugen <[EMAIL PROTECTED]> wrote:
> Altho I have read alot of the relevant documentation, and searched
> this group and the Web, I remain confused about these topics and their
> relationships.  Something is not sticking in my brain.
>
> I usually get something working by blind cut and paste.  Looking for a
> more conceptual explanation, or even some pointers to where to look
> next.
>
> Here's my current problem:
>
> in models.py:
>
>     def get_absolute_url(self):
>         prefix = "/org/%s/" % self.type.slug
>         return (prefix, None, {"org_slug": iri_to_uri(self.slug)})
>
> in urls.py:
>
>     url(r'^org/(\w)+/(?P<org_slug>[-\w]+)/$', 'orgs.views.org',
> name='org'),
>
> in a template:
>
>     {{ org.get_absolute_url }}
>
> returns nothing.  No error message.
>
> Error message from the shell:
>
> >>>org,get_absolute_url()
>
> [...]
> NoReverseMatch: Reverse for '/org/hoa/' with arguments '()' and
> keyword arguments '{'org_slug': 'cp'}' not found.
>
> If I enter the urlhttp://127.0.0.1:8000/org/hoa/cp/in the address
> bar, it works fine.
>
> Using current trunk and the Django dev server.
>
> What am I missing?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to