My urls are working without a trailing slash but not with one. Django
version 1.5, Python 2.7.
settings.APPEND_SLASH = True (but there is no difference if it is False)
Here is the working part ...
http://127.0.0.1:8000/item/search
When this search retrieves a list of xitems the urls to display them are
correct like this ...
http://127.0.0.1:8000/item/xitem/3
... and displays nicely.
Here is the failing one ...
http://127.0.0.1:8000/item/search/
When this search with a trailing slash retrieves the same list the hrefs
are incorrect because they include the 'search/' fragment like this ...
http://127.0.0.1:8000/item/search/xitem/3
Here is my urls.py which sits in the item directory ...
urlpatterns = patterns('item.views',
url(r'^search', 'search'),
url(r'^xitem/(?P<num>\d+)/$', 'display'),
)
get_absolute_url in the xitem model is ...
def get_absolute_url(self):
return 'xitem/%s' %
self.id
Any guidance will be appreciated. I have studied
https://docs.djangoproject.com/en/dev/topics/http/urls/ and experimented
with @models.permalink without success.
Thanks
Mike