Skip to content
Snippets Groups Projects
README.md 1.07 KiB
Newer Older
Olivier Le Brouster's avatar
Olivier Le Brouster committed
# Django News Box

This django app is a toolbox to easily setup news in your projects.

## Features

 * easy custom fields
 * optional SEO fields
 * optional publication period
 * optional i18n support via hvad
 * optional django-cms support

## Installation

## django CMS integration

### models.py

    class News(NewsboxCMSBase, NewsboxSEOBase):
        
        class Meta:
            newsbox_detail_url_name = "news_detail"  # optional

### cms_app.py

    class NewsApphook(CMSApp):
        name = _("News")
        urls = ["myproject.news_urls"]
    
    apphook_pool.register(NewsApphook)
    
    
### news_urls.py

    from django.conf.urls import patterns, url
    from newsbox.views import NewsboxDetailView
    from .models import News
    
    urlpatterns = patterns(
        '',
        url(
            r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[0-9a-zA-Z_-]+)/$', 
            NewsboxDetailView.as_view(
                template_name="myproject/news_detail.html",
                model=News,),
            name='news_detail'),
    )

### cms_plugin.py

TODO