Provides Articles using (FeinCMS content) with categories and tags.
Project description
Extensible FeinCMS content article for Django
============================================
This is an extensible FeinCMS content article system for Django, designed to
provide a simple Article model that is extensible. The concept (and some code)
is borrowed from the [FeinCMS](https://github.com/matthiask/feincms) Page
model.
Installation and setup
----------------------
Firstly, get the package.
pip install feincms-articles
You will then need to add `articles` to your `INSTALLED_APPS` setting.
Before proceeding with `manage.py syncdb`, you may want to add some article
extensions. By default the articles module has a basic set of content fields
such as title, summary and content.
Extensions
----------
Extensions are a way to add often-used functionality the Article model. The
extensions are standard python modules with a `register()` method which will be
called upon registering the extension. The `register()` method receives the
`Article` class itself and the model admin class `ArticleAdmin` as arguments.
The extensions can be activated by adding the following to a the bottom of a
`models.py` file that will be processed anyway:
from articles.models import Article
Article.register_extensions('articles.modules.category.extensions.category', 'datepublisher', 'tags', 'thumbnail')
If the extension requires it's own models (like the category extension) then
the app containing the models will also need to be added to your
`INSTALLED_APPS`.
ContentTypes
------------
You need to create some FeinCMS content types to add to your Articles. No
models are created by default, because there is no way to unregister
models. A sane default might be to create `ImageContent` and `RichTextContent`
models; you can do this by adding the following lines somewhere into your
project, for example at the bottom of a `models.py` file that will be processed
anyway:
from feincms.content.richtext.models import RichTextContent
from feincms.content.image.models import ImageContent
from articles.models import Article
Article.register_regions(('top', _('Top content')), ('main', _('Main region')),)
Article.create_content_type(RichTextContent)
Article.create_content_type(ImageContent, POSITION_CHOICES=(('block', _('block')), ('left', _('left')), ('right', _('right')),))
Adding extensions
-----------------
To add an extension create a python module that defines a register function
that accepts the Article class and the ArticleAdmin class as arguments and
modifies them as required.
Here is the address extension (profiles/extensions/tags.py):
def register(cls, admin_cls):
cls.add_to_class('tags', TaggableManager(verbose_name=_('tags'), blank=True))
cls.urlpatterns += patterns('taggit.views',
url(r'^tags/(?P<slug>[^/]+)/$', 'tagged_object_list', {'queryset': cls.objects.active}, name="article_tagged_list"),
)
if admin_cls:
if admin_cls.fieldsets:
admin_cls.fieldsets[0][1]['fields'].append('tags')
============================================
This is an extensible FeinCMS content article system for Django, designed to
provide a simple Article model that is extensible. The concept (and some code)
is borrowed from the [FeinCMS](https://github.com/matthiask/feincms) Page
model.
Installation and setup
----------------------
Firstly, get the package.
pip install feincms-articles
You will then need to add `articles` to your `INSTALLED_APPS` setting.
Before proceeding with `manage.py syncdb`, you may want to add some article
extensions. By default the articles module has a basic set of content fields
such as title, summary and content.
Extensions
----------
Extensions are a way to add often-used functionality the Article model. The
extensions are standard python modules with a `register()` method which will be
called upon registering the extension. The `register()` method receives the
`Article` class itself and the model admin class `ArticleAdmin` as arguments.
The extensions can be activated by adding the following to a the bottom of a
`models.py` file that will be processed anyway:
from articles.models import Article
Article.register_extensions('articles.modules.category.extensions.category', 'datepublisher', 'tags', 'thumbnail')
If the extension requires it's own models (like the category extension) then
the app containing the models will also need to be added to your
`INSTALLED_APPS`.
ContentTypes
------------
You need to create some FeinCMS content types to add to your Articles. No
models are created by default, because there is no way to unregister
models. A sane default might be to create `ImageContent` and `RichTextContent`
models; you can do this by adding the following lines somewhere into your
project, for example at the bottom of a `models.py` file that will be processed
anyway:
from feincms.content.richtext.models import RichTextContent
from feincms.content.image.models import ImageContent
from articles.models import Article
Article.register_regions(('top', _('Top content')), ('main', _('Main region')),)
Article.create_content_type(RichTextContent)
Article.create_content_type(ImageContent, POSITION_CHOICES=(('block', _('block')), ('left', _('left')), ('right', _('right')),))
Adding extensions
-----------------
To add an extension create a python module that defines a register function
that accepts the Article class and the ArticleAdmin class as arguments and
modifies them as required.
Here is the address extension (profiles/extensions/tags.py):
def register(cls, admin_cls):
cls.add_to_class('tags', TaggableManager(verbose_name=_('tags'), blank=True))
cls.urlpatterns += patterns('taggit.views',
url(r'^tags/(?P<slug>[^/]+)/$', 'tagged_object_list', {'queryset': cls.objects.active}, name="article_tagged_list"),
)
if admin_cls:
if admin_cls.fieldsets:
admin_cls.fieldsets[0][1]['fields'].append('tags')
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
feincms-articles-0.2.dev5.tar.gz
(11.1 kB
view details)
File details
Details for the file feincms-articles-0.2.dev5.tar.gz
.
File metadata
- Download URL: feincms-articles-0.2.dev5.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e5e3ab16ef3cb19adb143a056261de5bf4fcc79d349b37ddf8ec31d7ff1140f |
|
MD5 | b3fd10c26ab920e35db478d5f6387b17 |
|
BLAKE2b-256 | cd9a91c55338a91724b35360efaef25c2285e0731e302c46c32743a2c1cd7405 |