django-sboard /

Filename Size Date modified Message
36 B
2.9 KB
277 B

Node models

Node views

Example node view:


from zope.component import adapts
from zope.component import provideAdapter

class DetailsView(NodeView):
    # Mandatory part, defines which node this view is adapting.

# Below are listed possible ways, how to tell sistem about your view

# If name is not provided, it means, that this view is default view for
# adapted node. For example if you access node using this URL: /my-node/,
# then most specific view, without name will be used.

# If you specify name, then this view will be used for URL's like this:
/my-node/details/. As you can see, details comes right after node ID.
provideAdapter(DetailsView, name="details")

# You can adapt any existing view to any node, by giving secont parameter,
in this case (ICategory,). This parameter does axactly the same ting as
provideAdapter(DetailsView, (ICategory,), name="details")

Node URLs

Each node has unique key and may have not unique slug. If node does not have specified slug, then node URL will be constructed from unique key:


If node has slug, and slug is unique, then URL will be constructed using that slug:


If node slug is not unique, then URL will be constructed from slug and key:


We know that slug is not unique from node property ambiguous, if this property is set to True it means, that slug of this node is not unique.

Each node can be accessed directly, just providing direct node URL, described above and with specified action and action name (or action argument). Examples:


Also, in some cases, action can be a slug, in these cases address looks like this:


See node views section for more information, how view can be accessed using dynamic slugs instead actions.

Als, node can be rendered in specified format, form example:


This URL returns node in JSON format. You can register your custom formats.

You can get node URL using permalink method or nodeurl template tag.

In python files:

node.permalink('create', 'comment')

In templates:

{% load sboard %}

<a href="{{ node.permalink }}">{{ node.title }}</a>
<a href="{% nodeurl node 'update' %}">Edit</a>
<a href="{% nodeurl node 'create' 'comment' %}">Create comment</a>
<a href="{% nodeexturl node 'json' %}">JSON</a>