Skip to main content

staticblocks provides you with tools for content managers to easily include flatpage content as a snippet in your templates while retaining structured control over the templates themselves.

The template designers will define page blocks in the templates.

The content managers will choose which flatpage to use as the snippet embedded in each page block.

You must have ‘django.contrib.flatpages’ in your INSTALLED_APPS.

To install, add ‘staticblocks’ to your INSTALLED_APPS and re-run syncdb.

Using it

Code to write

On the template level, define your static blocks with arbitrary string labels by passing the label into the scope of the included template snippet:

{% with "index.html/firstpageblock" as blockname %}
  {% include 'staticblock/widgets/block.html' %}
{% endwith %}

{% with "index.html/secondpageblock" as blockname %}
  {% include 'staticblock/widgets/block.html' %}
{% endwith %}

On the site, allowed users will now be able to associate that page block with a flatpage, which will be pulled in as page content into that block.

Permissions to assign

Assign the following permisssions to your users and groups as desired:

flatpages.add_flatpage
flatpages.change_flatpage
staticblocks.add_staticblock
staticblocks.change_staticblock

Templates to use

You can customize the layout of the pulled-in block by editing or forking these templates:

staticblock/templates/staticblock/widgets/block.html
staticblock/templates/staticblock/widgets/title.html

Metadata

Release files for django-staticblocks 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-staticblocks 0.5
File Size Uploaded
django-staticblocks-0.5.tar.gz 3.1 kB Details

Release files / django-staticblocks-0.5.tar.gz

Download URL django-staticblocks-0.5.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8ca6a4a887ef7f0de8b6496679e3b7a06576a298e2add690239e1c484bc185a1
BLAKE2b-256 checksum
How to use checksums
7b110b77633f0afb0f7d1959de0401ee1780ade7d2327b1c63238969ec1336f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.5 This release

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page