示例#1
0
def _url_patterns_installed():
    # This module can use normal Django urls.py URLs, or mount the "FaqPage" in the page tree.
    # Check whether the URLs are installed, so the `sitemap.xml` can be generated nevertheless.
    # This issue will pop up elsewhere too, so there is no need to raise an error here.
    try:
        faq_reverse('faqcategory_detail', kwargs={'slug': 'category'}, ignore_multiple=True)
    except NoReverseMatch:
        return False
    else:
        return True
示例#2
0
def _url_patterns_installed():
    # This module can use normal Django urls.py URLs, or mount the "FaqPage" in the page tree.
    # Check whether the URLs are installed, so the `sitemap.xml` can be generated nevertheless.
    # This issue will pop up elsewhere too, so there is no need to raise an error here.
    try:
        faq_reverse('faqcategory_detail',
                    kwargs={'slug': 'category'},
                    ignore_multiple=True)
    except NoReverseMatch:
        return False
    else:
        return True
示例#3
0
 def location(self, question):
     """Return url of an question."""
     return faq_reverse('faqquestion_detail',
                        kwargs={
                            'cat_slug': question.category.slug,
                            'slug': question.slug
                        },
                        ignore_multiple=True)
示例#4
0
    def default_url(self):
        """
        The internal implementation of :func:`get_absolute_url`.
        This function can be used when overriding :func:`get_absolute_url` in the settings.
        For example::

            ABSOLUTE_URL_OVERRIDES = {
                'fluent_faq.FaqQuestion': lambda o: "http://example.com" + o.default_url
            }
        """
        with switch_language(self):
            root = faq_reverse('faqquestion_index', ignore_multiple=True, language_code=self.get_current_language())
            return root + self.get_relative_url()
示例#5
0
    def default_url(self):
        """
        The internal implementation of :func:`get_absolute_url`.
        This function can be used when overriding :func:`get_absolute_url` in the settings.
        For example::

            ABSOLUTE_URL_OVERRIDES = {
                'fluent_faq.FaqQuestion': lambda o: "http://example.com" + o.default_url
            }
        """
        with switch_language(self):
            root = faq_reverse('faqquestion_index', ignore_multiple=True, language_code=self.get_current_language())
            return root + self.get_relative_url()
示例#6
0
 def location(self, category):
     """Return url of an category."""
     return faq_reverse('faqcategory_detail',
                        kwargs={'slug': category.slug},
                        ignore_multiple=True)
示例#7
0
 def location(self, category):
     """Return url of an category."""
     return faq_reverse('faqcategory_detail', kwargs={'slug': category.slug}, ignore_multiple=True)
示例#8
0
 def location(self, question):
     """Return url of an question."""
     return faq_reverse('faqquestion_detail', kwargs={'cat_slug': question.category.slug, 'slug': question.slug}, ignore_multiple=True)