Friday, June 15, 2012

Re: trailing slash defeats get_absolute_url

On 15/06/2012 5:11pm, bruno desthuilliers wrote:
> You have to end your url patterns with a slash, ie r'^search/'.

Ok. I added a trailing slash to the get_absolute_url method like so ...
return 'xitem/%s/' % self.id ... and added an extra url pattern ...

urlpatterns = patterns('item.views',
url(r'^search/$', 'search'),
url(r'^search/xitem/(?P<num>\d+)/$', 'display'),
url(r'^xitem/(?P<num>\d+)/$', 'display'),
)

... and used $ to enforce the trailing slash everywhere - and it is all
working consistently.

Thanks Bruno

Mike


>

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