Clone wiki

django-pagecontents / usage


pagecontents provides page contents editing within your web applications and projects. It is not a full CMS engine.

Typical use

First, edit your page's template to add editable content markers. Add a ContentTag wherever you need editable content.

Then, create a page in your django admin. Set its label and template, save. When a page's template is defined, you can then set its contents (a field for each content marker).

In your project views, you can then use the pagecontents api to serve the page.


You can produce a page response using its primary key :

from pagecontents.api import page_response

def my_view(request):
    # my view logic
    return page_response(page_id, context)

page_response will return an HttpResponse? from your context, the page's template and saved contents for current language.


You can also produce a page's response using its path (if defined for the page in admin)

from pagecontents.api import response_for_path

def my_view(request):
    # my view logic
    return page_response(request.path, context)


You can have full dynamic pages by adding this line at the end of your urlpatterns in

url('', 'pagecontents.api.dynamic_view'),