Djedi CMS is more or less a highly configurable key/value store, built on top of the content pipeline library content-io.

All managed content within djedi is represented by a Node. Each node has a unique resource identifier called URI, which holds necessary information to lookup, persist or render node content.

Nodes also relies on Plugins handling the content serialization and rendering. Plugins gets resolved by the extension part of the node uri.

URI example:

i18n://[email protected]/home/

[scheme] :// [namespace] @ [path] . [extension] # [version]

Examine the URI and Plugins sections for deeper understanding and use cases.

Djedi in your templates

The most common way of using Djedi CMS is to make content editable and i18n compliant in your templates.

Load djedi_tags in a template and use the node or blocknode tags.

{% load djedi_tags %}
    <h1>{% node 'page/home/title.txt' default='Djedi' %}</h1>

    {% node 'page/home/logo.img' %}

    {% blocknode 'page/home/' %}
        ## I'm a djedi apprentice
        This is easy!
    {% endblocknode %}

Node tag

The node tag takes one argument, the URI, and two optional keyword arguments; default and edit.

  • default (empty unicode)

    Content displayed for new nodes / not persisted in the storage backend.

  • edit (True)

    Enable/disable inline editing. Useful if content is not visible, like a meta-tag or tag attribute, preventing user interaction.

<input placeholder="{% node 'foo/bar' default='Search' edit=False %}">

Blocknode tag

The blocknode tag is similar to the node tag except that it lacks the default keyword argument and using the block body as default content instead. Beyond the edit kwarg, the blocknode can take any arbitrary keyword argument for use as a content formatting context using python string format syntax.

{% blocknode 'page/home/' name=user.first_name %}
    ## Welcome {name}!
    I love using dynamic variables in my translatable texts.
{% endblocknode %}

Djedi in your code

>>> import cio
>>> node = cio.get('mail/receipt/subject', default=u'Thanks!')
>>> node.uri
<URI 'i18n://[email protected]/receipt/subject.txt'>
>>> node.content

>>> node = cio.set('[email protected]/receipt/subject', u'Tack!', publish=False)
>>> node.uri
<URI 'i18n://[email protected]/receipt/subject.txt#draft'>
>>> node.content

>>> node = cio.publish('[email protected]/receipt/subject.txt#draft')
>>> node.uri
<URI 'i18n://[email protected]/receipt/subject.txt#1'>

Table Of Contents

Related Topics

This Page