Skip to content
Snippets Groups Projects
Commit 0930c06e authored by Dylann Cordel's avatar Dylann Cordel :crossed_swords:
Browse files

Correction for python >= 3.0 with "u''" deletion

parent db53239b
No related branches found
No related tags found
No related merge requests found
......@@ -12,26 +12,77 @@ This django app is a toolbox to easily setup news in your projects.
## Installation
Add newsbox to your ``INSTALLED_APPS``. If you need newsbox_cms and/or
newsbox_hvad, add those too.
## django integration
## models.py
## django CMS integration
### models.py
class News(NewsboxCMSBase, NewsboxSEOBase):
For basic news, you just have to inherit from NewsboxCMSBase :
from newsbox_cms.models import NewsboxCMSBase
class News(NewsboxCMSBase):
class Meta:
newsbox_detail_url_name = "news_detail" # optional
You can create news with i18n via HVAD. Inherit first from NewsboxHVADBase, then
from NewsboxCMSBase :
from newsbox_cms.models import NewsboxCMSBase
from newsbox_hvad.models import NewsboxHVADBase
class News(NewsboxHVADBase, NewsboxCMSBase):
class Meta:
newsbox_detail_url_name = "news_detail" # optional
If you need SEO fields and/or expiration fields, inherit from
NewsboxSEOBase and/or NewsboxExpiredBase :
from newsbox.models import NewsboxSEOBase, NewsboxExpiredBase
from newsbox_cms.models import NewsboxCMSBase
class News(NewsboxCMSBase, NewsboxSEOBase, NewsboxExpiredBase):
class Meta:
newsbox_detail_url_name = "news_detail" # optional
For the plugin, you just have to inherit from NewsboxPluginBase :
from newsbox_cms.models import NewsboxPluginBase
class NewsPlugin(NewsboxPluginBase):
newsbox_model = News
### cms_app.py
Nothing special here. Just create your basic cms app :
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
class NewsApphook(CMSApp):
name = _("News")
urls = ["myproject.news_urls"]
apphook_pool.register(NewsApphook)
### news_urls.py
This file is used by your CMS App. You have to specify the news detail URL and
set the template and the model to use for this url.
from django.conf.urls import patterns, url
from newsbox.views import NewsboxDetailView
from .models import News
......@@ -48,4 +99,15 @@ This django app is a toolbox to easily setup news in your projects.
### cms_plugin.py
TODO
You just have to inherit from NewsboxPluginBase to create a plugin to manage
your news.
from cms.plugin_pool import plugin_pool
from newsbox_cms.cms_plugins import NewsboxPluginBase
from .models import NewsPlugin as NewsPluginModel
class NewsPlugin(NewsboxPluginBase):
model = NewsPluginModel
plugin_pool.register_plugin(NewsPlugin)
......@@ -155,7 +155,7 @@ class NewsboxAbstractModelsTests(TestCase):
"""
c = Client()
r = c.get('/news/?page=2')
news = self.get_news_in_list_by_summary(r, u'Summary of the news 4')
news = self.get_news_in_list_by_summary(r, 'Summary of the news 4')
self.assertIsNotNone(news)
found = self.has_readmore_link(news)
......@@ -167,7 +167,7 @@ class NewsboxAbstractModelsTests(TestCase):
"""
c = Client()
r = c.get('/news/2005/')
news = self.get_news_in_list_by_summary(r, u'Summary of the news 6')
news = self.get_news_in_list_by_summary(r, 'Summary of the news 6')
self.assertIsNotNone(news)
found = self.has_readmore_link(news)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment