예제 #1
0
 def get_redirect_url(self, **kwargs):
     path = self.get_path()
     try:
         page = UrlNode.objects.non_polymorphic().get_for_path(path)
         return get_page_admin_url(page)
     except UrlNode.DoesNotExist:
         # Back to page without @admin, display the error there.
         return '/' + re.sub('@[^@]+/?$', '', path)
예제 #2
0
 def get_redirect_url(self, **kwargs):
     path = self.get_path()
     try:
         page = UrlNode.objects.non_polymorphic().get_for_path(path)
         return get_page_admin_url(page)
     except UrlNode.DoesNotExist:
         # Back to page without @admin, display the error there.
         return '/' + re.sub('@[^@]+/?$', '', path)
예제 #3
0
    def get_redirect_url(self, **kwargs):
        # Avoid importing the admin too early via the URLconf.
        # This gives errors when 'fluent_pages' is not in INSTALLED_APPS yet.
        from fluent_pages.admin.utils import get_page_admin_url

        path = self.get_path()
        try:
            page = UrlNode.objects.non_polymorphic().get_for_path(path)
            return get_page_admin_url(page)
        except UrlNode.DoesNotExist:
            # Back to page without @admin, display the error there.
            return '/' + re.sub('@[^@]+/?$', '', path)
예제 #4
0
    def get_redirect_url(self, **kwargs):
        # Avoid importing the admin too early via the URLconf.
        # This gives errors when 'fluent_pages' is not in INSTALLED_APPS yet.
        from fluent_pages.admin.utils import get_page_admin_url

        path = self.get_path()
        try:
            page = UrlNode.objects.non_polymorphic().get_for_path(path)
            return get_page_admin_url(page)
        except UrlNode.DoesNotExist:
            # Back to page without @admin, display the error there.
            return '/' + re.sub('@[^@]+/?$', '', path)
예제 #5
0
    def get_redirect_url(self, **kwargs):
        # Avoid importing the admin too early via the URLconf.
        # This gives errors when 'fluent_pages' is not in INSTALLED_APPS yet.
        from fluent_pages.admin.utils import get_page_admin_url

        path = self.get_path()
        language_code = self.get_language()
        qs = UrlNode.objects.non_polymorphic().published()

        try:
            page = _try_languages(language_code, UrlNode.DoesNotExist,
                lambda lang: qs.get_for_path(path, language_code=lang)
            )
            url = get_page_admin_url(page)
        except UrlNode.DoesNotExist:
            # Back to page without @admin, display the error there.
            url = re.sub('@[^@]+/?$', '', self.request.path)

        return self.request.build_absolute_uri(url)
예제 #6
0
    def get_redirect_url(self, **kwargs):
        # Avoid importing the admin too early via the URLconf.
        # This gives errors when 'fluent_pages' is not in INSTALLED_APPS yet.
        from fluent_pages.admin.utils import get_page_admin_url

        path = self.get_path()
        language_code = self.get_language()
        qs = UrlNode.objects.non_polymorphic().published()

        try:
            page = _try_languages(
                language_code, UrlNode.DoesNotExist,
                lambda lang: qs.get_for_path(path, language_code=lang))
            url = get_page_admin_url(page)
        except UrlNode.DoesNotExist:
            # Back to page without @admin, display the error there.
            url = re.sub('@[^@]+/?$', '', self.request.path)

        return self.request.build_absolute_uri(url)