*This project has reached the end of its development as CMS framework.*
*It only receives low maintenance to continue running existing websites.*
*Feel free to browse the code, but please use other Django-based CMS frameworks such as*
`Wagtail CMS <https://wagtail.io/>`_ *when you start a new project.*
django-fluent-contents
======================
.. image:: http://unmaintained.tech/badge.svg
:target: http://unmaintained.tech
:alt: No Maintenance Intended
.. image:: https://github.com/django-fluent/django-fluent-contents/actions/workflows/tests.yaml/badge.svg?branch=master
:target: https://github.com/django-fluent/django-fluent-contents/actions/workflows/tests.yaml
.. image:: https://img.shields.io/pypi/v/django-fluent-contents.svg
:target: https://pypi.python.org/pypi/django-fluent-contents/
.. image:: https://img.shields.io/pypi/l/django-fluent-contents.svg
:target: https://pypi.python.org/pypi/django-fluent-contents/
.. image:: https://img.shields.io/codecov/c/github/django-fluent/django-fluent-contents/master.svg
:target: https://codecov.io/github/django-fluent/django-fluent-contents?branch=master
.. image:: https://readthedocs.org/projects/django-fluent-contents/badge/?version=latest
:target: https://django-fluent-contents.readthedocs.io/en/latest/
The *fluent_contents* module offers a widget engine to display various content on a Django page.
This engine operates similarly like Django CMS, FeinCMS, Wagtail's streaming field or django-portlets,
however, it can be used for any project, or CMS system.
Page contents can be constructed with multiple "content items".
You can define your own content items, or use one the available content items out of the box.
Standard web sites could use the bundled default content items.
Other advanced designs (such as a web site with a magazine-like design, having many blocks at a page)
can be implemented quickly by defining content items for the various "style elements" at the page.
Web editors are able to place the "content items" at the page,
hence they can fill the content of advanced layouts easily and directly in the Django admin.
This also applies to pages which have a "free form" or "presentation slide" design,
this module allows the end-user to manage and configure the designed elements at the page.
By default, the following content items are available:
**Standard content:**
* Text content - write rich text in a WYSIWYG editor (provided by django-wysiwyg_).
* Markup - write content with reStructuredText, Markdown or Textile (provided by *docutils*, *Markdown* or *textile*).
* Forms - display forms created with django-form-designer-ai_.
**Online content:**
* Google Docs viewer - display a PDF or DOCX file on a page, using the Google Docs Viewer service.
* OEmbed support - embed content from YouTube, Vimeo, SlideShare, Twitter, and more.
* Twitter feed - display a Twitter timeline, or realtime search timeline.
**For programmers:**
* Code - display code snippets with highlighting (provided by *Pygments*).
* Gist - display Gist snippets from Github.
* IFrame - display an ``<iframe>`` on the page.
* Raw HTML content - include jQuery snippets, or "embed codes" by other services.
* Shared content - display a set of items at multiple locations.
**Interactive:**
* Commentsarea - display comments on a page (provided by django.contrib.comments_).
* Disqusarea - display DISQUS comments on a page (provided by django-disqus_).
* Form-designer link - display a django-form-designer-ai_ form on a page.
For more details, see the documentation_ at Read The Docs.
Screenshot
==========
The ``PlaceholderField`` is nicely integrated in the Django admin interface:
.. image:: https://github.com/django-fluent/django-fluent-contents/raw/master/docs/images/admin/placeholderfieldadmin2.png
:width: 770px
:height: 562px
:alt: django-fluent-contents placeholder field preview
Secondly, it's possible to build a CMS Page interface with the ``PlaceholderEditorAdmin``,
which displays each content placeholder in a tab:
.. image:: https://github.com/django-fluent/django-fluent-contents/raw/master/docs/images/admin/placeholdereditoradmin1.png
:width: 770px
:height: 362px
:alt: django-fluent-contents placeholder editor preview
Installation
============
First install the module, preferably in a virtual environment. It can be installed from PyPI:
.. code-block:: bash
pip install django-fluent-contents
Or the current folder can be installed:
.. code-block:: bash
pip install .
The dependencies of plugins are not included by default. To install those, include the plugin names as extra option:
.. code-block:: bash
pip install django-fluent-contents[code,disquscommentsarea,formdesignerlink,markup,oembeditem,text,twitterfeed]
Configuration
-------------
Next, create a project which uses the module:
.. code-block:: bash
cd ..
django-admin.py startproject fluentdemo
It should have the following settings:
.. code-block:: python
INSTALLED_APPS += (
'fluent_contents',
# And optionally all plugins desired:
'fluent_contents.plugins.code',
'fluent_contents.plugins.commentsarea',
'fluent_contents.plugins.disquswidgets',
'fluent_contents.plugins.formdesignerlink',
'fluent_contents.plugins.gist',
'fluent_contents.plugins.googledocsviewer',
'fluent_contents.plugins.iframe',
'fluent_contents.plugins.markup',
'fluent_contents.plugins.rawhtml',
'fluent_contents.plugins.text',
# Some plugins need extra Django applications
'disqus',
'django.contrib.comments',
'django_wysiwyg',
'form_designer',
)
The database tables can be created afterwards:
.. code-block:: bash
./manage.py migrate
Finally, it needs a model or application that displays the content.
There are two ways to include content. The most simply way, is
adding a ``PlaceholderField`` to a model:
.. code-block:: python
# models.py:
from fluent_contents.models import PlaceholderField
class Article(models.Model):
title = models.CharField("Title", max_length=200)
slug = models.SlugField("Slug", unique=True)
content = PlaceholderField("article_content")
class Meta:
verbose_name = "Article"
verbose_name_plural = "Articles"
def __unicode__(self):
return self.title
# admin.py:
from fluent_contents.admin import PlaceholderFieldAdmin
class ArticleAdmin(PlaceholderFieldAdmin):
pass
admin.site.register(Article, ArticleAdmin)
The most advanced combination, is using the ``PlaceholderEditorAdmin`` or ``PlaceholderEditorAdminMixin`` classes.
These classes are designed for CMS-style applications which multiple placeholders on a page.
See the provided ``example`` application for details.
NOTE:
The django-fluent-pages_ application is built on top of this API, and provides a ready-to-use CMS that can be implemented with minimal configuration effort.
To build a custom CMS, the API documentation of the fluent_contents.admin_ module provides more details of the classes.
Details about the various settings are explained in the documentation_.
Creating custom content items
-----------------------------
To implement custom elements of a design - while making them editable for admins -
this module allows you to create custom content items.
Take a look in the existing types at ``fluent_contents.plugins`` to see how it's being done.
It boils down to creating a package with 2 files:
The ``models.py`` file should define the fields of the content item:
.. code-block:: python
from django.db import models
from fluent_contents.models import ContentItem
class AnnouncementBlockItem(ContentItem):
title = models.CharField("Title", max_length=200)
body = models.TextField("Body")
button_text = models.CharField("Text", max_length=200)
button_link = models.URLField("URL")
class Meta:
verbose_name = "Announcement block"
verbose_name_plural = "Announcement blocks"
def __unicode__(self):
return self.title
The ``content_plugins.py`` file defines the metadata and rendering:
.. code-block:: python
from fluent_contents.extensions import plugin_pool, ContentPlugin
from .models import AnnouncementBlockItem
@plugin_pool.register
class AnnouncementBlockPlugin(ContentPlugin):
model = AnnouncementBlockItem
render_template = "plugins/announcementblock.html"
category = "Simple blocks"
The plugin can also define the admin layout, by adding fields such as a ``fieldset``, but that is all optional.
The template could look like:
.. code-block:: html+django
<div class="announcement">
<h3>{{ instance.title }}</h3>
<div class="text">
{{ instance.body|linebreaks }}
</div>
<p class="button"><a href="{{ instance.button_url }}">{{ instance.button_text }}</a></p>
</div>
Et, voila: web editors are now able to place an announcement items at the page
in a very structured manner! Other content items can be created in the same way,
either in the same Django application, or in a separate application.
Contributing
------------
This module is designed to be generic. In case there is anything you didn't like about it,
or think it's not flexible enough, please let us know. We'd love to improve it!
If you have any other valuable contribution, suggestion or idea,
please let us know as well because we will look into it.
Pull requests are welcome too. :-)
.. _documentation: http://django-fluent-contents.readthedocs.org/
.. _fluent_contents.admin: http://django-fluent-contents.readthedocs.org/en/latest/cms.html
.. _django.contrib.comments: https://docs.djangoproject.com/en/dev/ref/contrib/comments/
.. _django-disqus: https://github.com/arthurk/django-disqus
.. _django-fluent-comments: https://github.com/django-fluent/django-fluent-comments
.. _django-fluent-pages: https://github.com/django-fluent/django-fluent-pages
.. _django-form-designer-ai: https://github.com/andersinno/django-form-designer-ai
.. _django-polymorphic: https://github.com/django-polymorphic/django-polymorphic
.. _django-wysiwyg: https://github.com/pydanny/django-wysiwyg
Raw data
{
"_id": null,
"home_page": "https://github.com/edoburu/django-fluent-contents",
"name": "django-fluent-contents",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Diederik van der Boor",
"author_email": "opensource@edoburu.nl",
"download_url": "https://files.pythonhosted.org/packages/ce/e5/fdac7e8b7c8402b6fe295a2c05e903c80af9db9dc8c20ea5744c3d1eda19/django-fluent-contents-3.1.tar.gz",
"platform": null,
"description": "*This project has reached the end of its development as CMS framework.*\n*It only receives low maintenance to continue running existing websites.*\n*Feel free to browse the code, but please use other Django-based CMS frameworks such as*\n`Wagtail CMS <https://wagtail.io/>`_ *when you start a new project.*\n\ndjango-fluent-contents\n======================\n\n.. image:: http://unmaintained.tech/badge.svg\n :target: http://unmaintained.tech\n :alt: No Maintenance Intended\n.. image:: https://github.com/django-fluent/django-fluent-contents/actions/workflows/tests.yaml/badge.svg?branch=master\n :target: https://github.com/django-fluent/django-fluent-contents/actions/workflows/tests.yaml\n.. image:: https://img.shields.io/pypi/v/django-fluent-contents.svg\n :target: https://pypi.python.org/pypi/django-fluent-contents/\n.. image:: https://img.shields.io/pypi/l/django-fluent-contents.svg\n :target: https://pypi.python.org/pypi/django-fluent-contents/\n.. image:: https://img.shields.io/codecov/c/github/django-fluent/django-fluent-contents/master.svg\n :target: https://codecov.io/github/django-fluent/django-fluent-contents?branch=master\n.. image:: https://readthedocs.org/projects/django-fluent-contents/badge/?version=latest\n :target: https://django-fluent-contents.readthedocs.io/en/latest/\n\n\nThe *fluent_contents* module offers a widget engine to display various content on a Django page.\n\nThis engine operates similarly like Django CMS, FeinCMS, Wagtail's streaming field or django-portlets,\nhowever, it can be used for any project, or CMS system.\n\nPage contents can be constructed with multiple \"content items\".\nYou can define your own content items, or use one the available content items out of the box.\nStandard web sites could use the bundled default content items.\nOther advanced designs (such as a web site with a magazine-like design, having many blocks at a page)\ncan be implemented quickly by defining content items for the various \"style elements\" at the page.\n\nWeb editors are able to place the \"content items\" at the page,\nhence they can fill the content of advanced layouts easily and directly in the Django admin.\nThis also applies to pages which have a \"free form\" or \"presentation slide\" design,\nthis module allows the end-user to manage and configure the designed elements at the page.\n\nBy default, the following content items are available:\n\n**Standard content:**\n\n* Text content - write rich text in a WYSIWYG editor (provided by django-wysiwyg_).\n* Markup - write content with reStructuredText, Markdown or Textile (provided by *docutils*, *Markdown* or *textile*).\n* Forms - display forms created with django-form-designer-ai_.\n\n**Online content:**\n\n* Google Docs viewer - display a PDF or DOCX file on a page, using the Google Docs Viewer service.\n* OEmbed support - embed content from YouTube, Vimeo, SlideShare, Twitter, and more.\n* Twitter feed - display a Twitter timeline, or realtime search timeline.\n\n**For programmers:**\n\n* Code - display code snippets with highlighting (provided by *Pygments*).\n* Gist - display Gist snippets from Github.\n* IFrame - display an ``<iframe>`` on the page.\n* Raw HTML content - include jQuery snippets, or \"embed codes\" by other services.\n* Shared content - display a set of items at multiple locations.\n\n**Interactive:**\n\n* Commentsarea - display comments on a page (provided by django.contrib.comments_).\n* Disqusarea - display DISQUS comments on a page (provided by django-disqus_).\n* Form-designer link - display a django-form-designer-ai_ form on a page.\n\nFor more details, see the documentation_ at Read The Docs.\n\n\nScreenshot\n==========\n\nThe ``PlaceholderField`` is nicely integrated in the Django admin interface:\n\n.. image:: https://github.com/django-fluent/django-fluent-contents/raw/master/docs/images/admin/placeholderfieldadmin2.png\n :width: 770px\n :height: 562px\n :alt: django-fluent-contents placeholder field preview\n\nSecondly, it's possible to build a CMS Page interface with the ``PlaceholderEditorAdmin``,\nwhich displays each content placeholder in a tab:\n\n.. image:: https://github.com/django-fluent/django-fluent-contents/raw/master/docs/images/admin/placeholdereditoradmin1.png\n :width: 770px\n :height: 362px\n :alt: django-fluent-contents placeholder editor preview\n\n\nInstallation\n============\n\nFirst install the module, preferably in a virtual environment. It can be installed from PyPI:\n\n.. code-block:: bash\n\n pip install django-fluent-contents\n\nOr the current folder can be installed:\n\n.. code-block:: bash\n\n pip install .\n\nThe dependencies of plugins are not included by default. To install those, include the plugin names as extra option:\n\n.. code-block:: bash\n\n pip install django-fluent-contents[code,disquscommentsarea,formdesignerlink,markup,oembeditem,text,twitterfeed]\n\nConfiguration\n-------------\n\nNext, create a project which uses the module:\n\n.. code-block:: bash\n\n cd ..\n django-admin.py startproject fluentdemo\n\nIt should have the following settings:\n\n.. code-block:: python\n\n INSTALLED_APPS += (\n 'fluent_contents',\n\n # And optionally all plugins desired:\n 'fluent_contents.plugins.code',\n 'fluent_contents.plugins.commentsarea',\n 'fluent_contents.plugins.disquswidgets',\n 'fluent_contents.plugins.formdesignerlink',\n 'fluent_contents.plugins.gist',\n 'fluent_contents.plugins.googledocsviewer',\n 'fluent_contents.plugins.iframe',\n 'fluent_contents.plugins.markup',\n 'fluent_contents.plugins.rawhtml',\n 'fluent_contents.plugins.text',\n\n # Some plugins need extra Django applications\n 'disqus',\n 'django.contrib.comments',\n 'django_wysiwyg',\n 'form_designer',\n )\n\nThe database tables can be created afterwards:\n\n.. code-block:: bash\n\n ./manage.py migrate\n\nFinally, it needs a model or application that displays the content.\nThere are two ways to include content. The most simply way, is\nadding a ``PlaceholderField`` to a model:\n\n.. code-block:: python\n\n # models.py:\n \n from fluent_contents.models import PlaceholderField\n\n class Article(models.Model):\n title = models.CharField(\"Title\", max_length=200)\n slug = models.SlugField(\"Slug\", unique=True)\n content = PlaceholderField(\"article_content\")\n\n class Meta:\n verbose_name = \"Article\"\n verbose_name_plural = \"Articles\"\n\n def __unicode__(self):\n return self.title\n\n\n # admin.py:\n \n from fluent_contents.admin import PlaceholderFieldAdmin\n\n class ArticleAdmin(PlaceholderFieldAdmin):\n pass\n\n admin.site.register(Article, ArticleAdmin)\n\nThe most advanced combination, is using the ``PlaceholderEditorAdmin`` or ``PlaceholderEditorAdminMixin`` classes.\nThese classes are designed for CMS-style applications which multiple placeholders on a page.\nSee the provided ``example`` application for details.\n\nNOTE:\n\n The django-fluent-pages_ application is built on top of this API, and provides a ready-to-use CMS that can be implemented with minimal configuration effort.\n To build a custom CMS, the API documentation of the fluent_contents.admin_ module provides more details of the classes.\n\nDetails about the various settings are explained in the documentation_.\n\n\nCreating custom content items\n-----------------------------\n\nTo implement custom elements of a design - while making them editable for admins -\nthis module allows you to create custom content items.\nTake a look in the existing types at ``fluent_contents.plugins`` to see how it's being done.\n\nIt boils down to creating a package with 2 files:\n\nThe ``models.py`` file should define the fields of the content item:\n\n.. code-block:: python\n\n from django.db import models\n from fluent_contents.models import ContentItem\n\n class AnnouncementBlockItem(ContentItem):\n title = models.CharField(\"Title\", max_length=200)\n body = models.TextField(\"Body\")\n button_text = models.CharField(\"Text\", max_length=200)\n button_link = models.URLField(\"URL\")\n\n class Meta:\n verbose_name = \"Announcement block\"\n verbose_name_plural = \"Announcement blocks\"\n\n def __unicode__(self):\n return self.title\n\nThe ``content_plugins.py`` file defines the metadata and rendering:\n\n.. code-block:: python\n\n from fluent_contents.extensions import plugin_pool, ContentPlugin\n from .models import AnnouncementBlockItem\n\n @plugin_pool.register\n class AnnouncementBlockPlugin(ContentPlugin):\n model = AnnouncementBlockItem\n render_template = \"plugins/announcementblock.html\"\n category = \"Simple blocks\"\n\nThe plugin can also define the admin layout, by adding fields such as a ``fieldset``, but that is all optional.\nThe template could look like:\n\n.. code-block:: html+django\n\n <div class=\"announcement\">\n <h3>{{ instance.title }}</h3>\n <div class=\"text\">\n {{ instance.body|linebreaks }}\n </div>\n <p class=\"button\"><a href=\"{{ instance.button_url }}\">{{ instance.button_text }}</a></p>\n </div>\n\nEt, voila: web editors are now able to place an announcement items at the page\nin a very structured manner! Other content items can be created in the same way,\neither in the same Django application, or in a separate application.\n\n\nContributing\n------------\n\nThis module is designed to be generic. In case there is anything you didn't like about it,\nor think it's not flexible enough, please let us know. We'd love to improve it!\n\nIf you have any other valuable contribution, suggestion or idea,\nplease let us know as well because we will look into it.\nPull requests are welcome too. :-)\n\n\n.. _documentation: http://django-fluent-contents.readthedocs.org/\n.. _fluent_contents.admin: http://django-fluent-contents.readthedocs.org/en/latest/cms.html\n\n.. _django.contrib.comments: https://docs.djangoproject.com/en/dev/ref/contrib/comments/\n.. _django-disqus: https://github.com/arthurk/django-disqus\n.. _django-fluent-comments: https://github.com/django-fluent/django-fluent-comments\n.. _django-fluent-pages: https://github.com/django-fluent/django-fluent-pages\n.. _django-form-designer-ai: https://github.com/andersinno/django-form-designer-ai\n.. _django-polymorphic: https://github.com/django-polymorphic/django-polymorphic\n.. _django-wysiwyg: https://github.com/pydanny/django-wysiwyg\n\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "A widget engine to display various content on Django pages",
"version": "3.1",
"project_urls": {
"Download": "https://github.com/edoburu/django-fluent-contents/zipball/master",
"Homepage": "https://github.com/edoburu/django-fluent-contents"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ac4450f8db02dce0fe436f10d6f8395f9b7553e315616f6550af6479d1affab6",
"md5": "186175844c5984d0402c91e7c96bfe0f",
"sha256": "a940f29e266154f471c6347ed4bbb0eb0aca855dd88893475e1cc0c76f358da8"
},
"downloads": -1,
"filename": "django_fluent_contents-3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "186175844c5984d0402c91e7c96bfe0f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 253367,
"upload_time": "2024-02-05T13:08:33",
"upload_time_iso_8601": "2024-02-05T13:08:33.615708Z",
"url": "https://files.pythonhosted.org/packages/ac/44/50f8db02dce0fe436f10d6f8395f9b7553e315616f6550af6479d1affab6/django_fluent_contents-3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cee5fdac7e8b7c8402b6fe295a2c05e903c80af9db9dc8c20ea5744c3d1eda19",
"md5": "fd8f4d958d618921e0307b682265cf8d",
"sha256": "3f3c87477bb8eef619f7557d816e6ebff8a36f0d552478e89933b7cbf59d3171"
},
"downloads": -1,
"filename": "django-fluent-contents-3.1.tar.gz",
"has_sig": false,
"md5_digest": "fd8f4d958d618921e0307b682265cf8d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 177084,
"upload_time": "2024-02-05T13:08:35",
"upload_time_iso_8601": "2024-02-05T13:08:35.524655Z",
"url": "https://files.pythonhosted.org/packages/ce/e5/fdac7e8b7c8402b6fe295a2c05e903c80af9db9dc8c20ea5744c3d1eda19/django-fluent-contents-3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-05 13:08:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "edoburu",
"github_project": "django-fluent-contents",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "django-fluent-contents"
}