Some followup, in case some other poor soul searches for this topic:
I found some better doc for get-absolute-url() here:
http://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#get-absolute-url
Including a better example:
@models.permalink
def get_absolute_url(self):
Got the url tag version working this way:
Changed the url pattern to:
url(r'^org/(?P[-\w]+)/(?P[-\w]+)/$',
'orgs.views.org', name='organization'),
And the template to:
{% url organization type_slug=org.type.slug, org_slug=org.slug %}
And added the new keyword to the view.
But I'm
Tried going about this another way:
In the template:
{% url orgs.views.org org.type.slug, org_slug=org.slug %}
That gets me this error message:
Don't mix *args and **kwargs in call to reverse()!
But how is that different from this example in the Django doc?
Shabda,
Thanks for trying, but:
> return ('orgs.views.org', [self.type.slug, self.slug])
In the shell, that gets me:
TypeError: reverse() argument after ** must be a dictionary
But do I understand correctly that the first argument shd be a view?
And that what gets returned from
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
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
6 matches
Mail list logo