All views of the CMS

The CurrentPageMixin class

class fluent_pages.views.CurrentPageMixin

Access the current page. This can be used for views which are defined as page type views in PageTypePlugin.urls.

The template context will have the same variables as the regular page templates would have, which are: * page * site * FLUENT_PAGES_BASE_TEMPLATE


Add the plugin context to the template.


Return the current page.


When using the ViewUrlMixin.view_url_name feature of django-parler, this makes sure that mounted pages are also supported.

It uses fluent_pages.urlresolvers.mixed_reverse() function to resolve the view_url_name.

The CurrentPageTemplateMixin class

class fluent_pages.views.CurrentPageTemplateMixin

Automaticaly reuse the template of the current page for the URL pattern view.


Auto-include the template of the CMS page.

The RobotsTxtView class

class fluent_pages.views.RobotsTxtView(**kwargs)

Exposing a robots.txt template in the Django project.

Add this view to the urls.py:

from fluent_pages.views import RobotsTxtView

urlpatterns = [
    # ...

    url(r'^robots.txt$', RobotsTxtView.as_view()),

Naturally, this pattern should be placed outside i18n_patterns() as it should appear at the top level.

A robots.txt template is included by default, which you have override in your own project. Possible templates could look like:


Sitemap: {{ ROOT_URL }}sitemap.xml
User-agent: *
Disallow: /
{% endif %}

Sitemaps per language for usage with i18n_patterns():

{% for language in language_codes %}Sitemap: {{ ROOT_URL }}{{ language }}/sitemap.xml
{% endfor %}


{% for sitemap_url in sitemap_urls %}Sitemap: {{ sitemap_url }}
{% endfor %}

Return the possible values that i18n_patterns() support.


Return all possible sitemap URLs, which the template can use.


Check whether something like i18n_patterns() is used.

render_to_response(context, **response_kwargs)

Return a response, using the response_class for this view, with a template rendered with the given context.

Pass response_kwargs to the constructor of the response class.

content_type = 'text/plain'

The content_type to return.

template_name = 'robots.txt'

The template to render. You can override this template.