Easily add CMS functionality to your Django site
Project description
django-freeplay
Freeplay is a new approach for easily adding CMS functionality to your Django app. Define regions for managing (and allowing clients to manage) bits of content on your site that don’t need the full build-out of custom apps. For example, that list of links in the footer, or the photo and bio of the CEO. With Freeplay, each region can contain one or many items, so you quickly gain flexible model-like functionality.
Each bit of content gets rendered onsave with Django’s template processor, so you have all the power of the Django’s parser.
Installation
pip install django-freeplay
Add 'freeplay' to your INSTALLED_APPS in your project’s settings.py
(Optional) Add (r"^admin/freeplay/", include("freeplay.urls_admin")), to your main urls.py, before you include the admin urls
Sync your db or use your migration tool of choice (recommended: nashvegas)
Requirements
Installing freeplay will also bring django-model-utils, django-imagekit, and django-relatedadminwidget with it.
The admin templates assume the existence of a few CSS and JS libraries: Chosen, Isotope, and jQuery.Slugify. Simply override the templates with ones in your project to define your own paths or libs.
Usage
In the django admin, create a new freeplay Template. Start by defining the template bits and then write the template code. For example, let’s say we want to manage a few FAQs. We’d create one bit like so:
And another:
(Note: if you use Markdown, be sure you’ve added markdown to your requirements)
When you set up the bits for a template, you’re defining the form that you or your clients will use to add and edit content for items that use this template. As such, you can include help text with each bit.
Now we can write the following for the template Code:
<span class="number">{{ order }}</span>
{{ question|title }}
<div class="answer">{{ answer|safe }}</div>
Note we need to use the safe filter for HTML content, and also that each item will include its “order” in context as well as “label”.
As soon as you have a template, create a Region and then you can start adding content, which is easily done using the included admin urls and templates.
Also
Freeplay regions let you set “Min Items” and “Max Items”, optionally. On the freeplay admin dashboard, it will then alert you if a region needs more content to meet the minimum requirement and won’t show the “Add” link if the region has met the maximum limit.
Hope you find this useful!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-freeplay-0.1.4.tar.gz
.
File metadata
- Download URL: django-freeplay-0.1.4.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8020477308b08fe715a437f58002135c19cfd86e03e569376db54f8d82a8b359 |
|
MD5 | 7fade8f2817cfd8047d776e5261af0b7 |
|
BLAKE2b-256 | 74a10b9fb32412d724584efbcf33c97f59292671a249c4edfd988a672b1b74b9 |
Provenance
File details
Details for the file django-freeplay-0.1.4.macosx-10.8-x86_64.tar.gz
.
File metadata
- Download URL: django-freeplay-0.1.4.macosx-10.8-x86_64.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17927cd4aa54a5256bf5951f22fba1295f19f7fc22ea0eee6f32f0d7dbd22401 |
|
MD5 | 5066c3bd143c68f143dab7ee897f427a |
|
BLAKE2b-256 | dab6019d447e32a82b39a989e363b051941b524c73387ee41cc9ec0fe099a221 |