Sorry, I was wrong. The url pattern must have a trailing slash. On Nov 9, 9:33 am, devbird <antig...@gmail.com> wrote: > you should set the "root url" as '^$'(an empty string), without any > '/', and remove the slash from the url pattern regexp. > > On Nov 8, 2:07 pm, Dirk Eschler <esch...@gmail.com> wrote: > > > > > Hello, > > > i've built an app which is based on Django's flatpages app. It reuses most > > of > > its features including the FlatPageFallbackMiddleware. > > > Everything works fine except when the root url '/' is used as url, in which > > case get_absolute_url returns '//'. The hostname defined in the sites app is > > not included, so the browser will treat the link as 'http:///'. > > > How can i get around this problem? Setting APPEND_SLASH to False doesn't > > make > > any difference. > > > models.py: > > ========== > > class ContentPage(MediaAwareManagedContent): > > url = models.CharField(_(u'URL'), max_length=100, db_index=True) > > > @models.permalink > > def get_absolute_url(self): > > url = self.url > > if self.url[0] == '/' and self.url != '/': > > url = self.url[1:] > > return ('content_page_detail', (), {'url': url}) > > > url.py: > > ======= > > urlpatterns = patterns('cms.contentpage.views', > > url(r'^(?P<url>.*/)$', 'contentpage', name='content_page_detail'), > > ) > > > Best Regards, > > Dirk Eschler > > > -- > > Dirk Eschler <esch...@gmail.com>
-- 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.