Add Django 1.8 support
This commit is contained in:
parent
3238c0f912
commit
e1fecbacba
16 changed files with 50 additions and 46 deletions
|
@ -6,8 +6,10 @@ History
|
|||
0.5.0 (XXXX-XX-XX)
|
||||
++++++++++++++++++
|
||||
|
||||
* Add support for Django 1.8
|
||||
* Drop dependency on Django select2
|
||||
* Code cleanups
|
||||
* Enforce flake8 / isort checks
|
||||
|
||||
0.4.0 (2015-03-22)
|
||||
++++++++++++++++++
|
||||
|
|
|
@ -11,15 +11,14 @@ HELPER_SETTINGS = dict(
|
|||
],
|
||||
ROOT_URLCONF='tests.test_utils.urls',
|
||||
INSTALLED_APPS=[
|
||||
'admin_enhancer',
|
||||
'filer',
|
||||
'parler',
|
||||
'taggit',
|
||||
'meta',
|
||||
'meta_mixin',
|
||||
'easy_thumbnails',
|
||||
'djangocms_text_ckeditor',
|
||||
'cmsplugin_filer_image',
|
||||
'taggit',
|
||||
'taggit_autosuggest',
|
||||
],
|
||||
LANGUAGE_CODE='en',
|
||||
|
@ -91,6 +90,12 @@ HELPER_SETTINGS = dict(
|
|||
if 'test' in sys.argv or len(sys.argv) == 1:
|
||||
HELPER_SETTINGS['INSTALLED_APPS'].append('django_nose')
|
||||
|
||||
try:
|
||||
import admin_enhancer
|
||||
HELPER_SETTINGS['INSTALLED_APPS'].append('admin_enhancer')
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
def run():
|
||||
from djangocms_helper import runner
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from copy import deepcopy
|
||||
|
||||
try:
|
||||
from admin_enhancer.admin import EnhancedModelAdminMixin
|
||||
except ImportError:
|
||||
class EnhancedModelAdminMixin(object):
|
||||
pass
|
||||
from cms.admin.placeholderadmin import FrontendEditableAdminMixin, PlaceholderAdminMixin
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
|
|
|
@ -1,25 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import taggit_autosuggest.managers
|
||||
import filer.fields.image
|
||||
import meta_mixin.models
|
||||
import djangocms_text_ckeditor.fields
|
||||
import cms.models.fields
|
||||
import django.utils.timezone
|
||||
import djangocms_text_ckeditor.fields
|
||||
import filer.fields.image
|
||||
import meta_mixin.models
|
||||
import taggit_autosuggest.managers
|
||||
from django.conf import settings
|
||||
from django.conf import settings
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('cms', '0003_auto_20140926_2347'),
|
||||
('taggit', '__first__'),
|
||||
('filer', '0001_initial'),
|
||||
('cmsplugin_filer_image', '0001_initial'),
|
||||
('cms', '__latest__'),
|
||||
('taggit', '__latest__'),
|
||||
('filer', '__latest__'),
|
||||
('cmsplugin_filer_image', '__latest__'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.db import models, migrations
|
|||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('sites', '0001_initial'),
|
||||
('sites', '__latest__'),
|
||||
('djangocms_blog', '0001_initial'),
|
||||
]
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from cms.models import CMSPlugin, PlaceholderField
|
||||
from cmsplugin_filer_image.models import ThumbnailOption
|
||||
from django.conf import settings as dj_settings
|
||||
from django.contrib.sites.models import Site
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
@ -87,31 +85,28 @@ class Post(ModelMeta, TranslatableModel):
|
|||
date_published_end = models.DateTimeField(_(u'published Until'), null=True,
|
||||
blank=True)
|
||||
publish = models.BooleanField(_(u'publish'), default=False)
|
||||
categories = models.ManyToManyField(BlogCategory, verbose_name=_(u'category'),
|
||||
categories = models.ManyToManyField('djangocms_blog.BlogCategory', verbose_name=_(u'category'),
|
||||
related_name='blog_posts',)
|
||||
main_image = FilerImageField(verbose_name=_(u'main image'), blank=True, null=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='djangocms_blog_post_image')
|
||||
main_image_thumbnail = models.ForeignKey(ThumbnailOption,
|
||||
main_image_thumbnail = models.ForeignKey('cmsplugin_filer_image.ThumbnailOption',
|
||||
verbose_name=_(u'main image thumbnail'),
|
||||
related_name='djangocms_blog_post_thumbnail',
|
||||
on_delete=models.SET_NULL,
|
||||
blank=True, null=True)
|
||||
main_image_full = models.ForeignKey(ThumbnailOption,
|
||||
main_image_full = models.ForeignKey('cmsplugin_filer_image.ThumbnailOption',
|
||||
verbose_name=_(u'main image full'),
|
||||
related_name='djangocms_blog_post_full',
|
||||
on_delete=models.SET_NULL,
|
||||
blank=True, null=True)
|
||||
enable_comments = models.BooleanField(
|
||||
verbose_name=_(u'enable comments on post'),
|
||||
default=get_setting('ENABLE_COMMENTS')
|
||||
)
|
||||
sites = models.ManyToManyField(Site, verbose_name=_(u'Site(s)'), blank=True,
|
||||
enable_comments = models.BooleanField(verbose_name=_(u'enable comments on post'),
|
||||
default=get_setting('ENABLE_COMMENTS'))
|
||||
sites = models.ManyToManyField('sites.Site', verbose_name=_(u'Site(s)'), blank=True,
|
||||
null=True,
|
||||
help_text=_(u'Select sites in which to show the post. '
|
||||
u'If none is set it will be '
|
||||
u'visible in all the configured sites.')
|
||||
)
|
||||
u'visible in all the configured sites.'))
|
||||
|
||||
translations = TranslatedFields(
|
||||
title=models.CharField(_(u'title'), max_length=255),
|
||||
|
@ -254,7 +249,7 @@ class LatestPostsPlugin(BasePostPlugin):
|
|||
help_text=_(u'The number of latests articles to be displayed.'))
|
||||
tags = models.ManyToManyField('taggit.Tag', blank=True, verbose_name=_(u'filter by tag'),
|
||||
help_text=_(u'Show only the blog articles tagged with chosen tags.'))
|
||||
categories = models.ManyToManyField('BlogCategory', blank=True, verbose_name=_(u'filter by category'),
|
||||
categories = models.ManyToManyField('djangocms_blog.BlogCategory', blank=True, verbose_name=_(u'filter by category'),
|
||||
help_text=_(u'Show only the blog articles tagged with chosen categories.'))
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{% load i18n thumbnail cms_tags %}
|
||||
{% load url from future %}
|
||||
|
||||
<article id="post-{{ post.slug }}" class="post-item">
|
||||
<header>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{% load i18n thumbnail cms_tags %}
|
||||
{% load url from future %}
|
||||
|
||||
<ul class="post-detail">
|
||||
{% if post.author %}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{% load i18n %}
|
||||
{% load url from future %}{% spaceless %}
|
||||
{% load i18n %}{% spaceless %}
|
||||
<div class="plugin plugin-blog">
|
||||
<h3>{% trans "Archive" %}</h3>
|
||||
{% regroup dates by date.year as years %}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{% load i18n %}
|
||||
{% load url from future %}{% spaceless %}
|
||||
{% load i18n %}{% spaceless %}
|
||||
<div class="plugin plugin-blog">
|
||||
<h3>{% trans "Categories" %}</h3>
|
||||
<ul class="blog-categories">
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{% load i18n %}
|
||||
{% load url from future %}{% spaceless %}
|
||||
{% load i18n %}{% spaceless %}
|
||||
<div class="plugin plugin-blog">
|
||||
<h3>{% trans "Tags" %}</h3>
|
||||
<ul class="blog-tags">
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{% extends "djangocms_blog/base.html" %}
|
||||
{% load i18n thumbnail cms_tags %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block meta_description %}{{ post.meta_description }}{% endblock meta_description %}
|
||||
{% block meta_keywords %}{{ post.meta_keywords }}{% endblock meta_keywords %}
|
||||
|
|
|
@ -5,5 +5,5 @@ mock>=1.0.1
|
|||
nose>=1.3.0
|
||||
django-nose>=1.2
|
||||
flake8
|
||||
djangocms-helper>=0.7
|
||||
https://github.com/nephila/djangocms-helper/archive/develop.zip
|
||||
tox>=2.0
|
||||
|
|
5
setup.py
5
setup.py
|
@ -44,7 +44,6 @@ setup(
|
|||
'pytz',
|
||||
'django-taggit-templatetags',
|
||||
'django-taggit-autosuggest',
|
||||
'django-admin-enhancer',
|
||||
'djangocms-text-ckeditor',
|
||||
'cmsplugin-filer',
|
||||
'django-meta>=0.2',
|
||||
|
@ -54,6 +53,10 @@ setup(
|
|||
zip_safe=False,
|
||||
keywords='djangocms-blog, blog, django, wordpress, multilingual',
|
||||
test_suite='cms_helper.run',
|
||||
extras_require={
|
||||
'admin-enhancer': ['django-admin-enhancer'],
|
||||
},
|
||||
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta',
|
||||
'Framework :: Django',
|
||||
|
|
|
@ -26,7 +26,7 @@ class PluginTest(BaseTest):
|
|||
tag = Tag.objects.get(slug='tag-1')
|
||||
plugin.tags.add(tag)
|
||||
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
||||
context = RequestContext(request, {})
|
||||
context = RequestContext(request, {'request': request})
|
||||
rendered = plugin.render_plugin(context, ph)
|
||||
self.assertTrue(rendered.find('cms_plugin-djangocms_blog-post-abstract-1') > -1)
|
||||
self.assertTrue(rendered.find(reverse('djangocms_blog:posts-tagged', kwargs={'tag': tag.slug})) > -1)
|
||||
|
@ -43,7 +43,7 @@ class PluginTest(BaseTest):
|
|||
plugin = add_plugin(ph, 'BlogLatestEntriesPlugin', language='en')
|
||||
plugin.categories.add(category_2)
|
||||
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
||||
context = RequestContext(request, {})
|
||||
context = RequestContext(request, {'request': request})
|
||||
rendered = plugin.render_plugin(context, ph)
|
||||
self.assertTrue(rendered.find('cms_plugin-djangocms_blog-post-abstract-2') > -1)
|
||||
self.assertTrue(rendered.find(reverse('djangocms_blog:posts-category', kwargs={'category': category_2.slug})) > -1)
|
||||
|
@ -63,7 +63,7 @@ class PluginTest(BaseTest):
|
|||
plugin = add_plugin(ph, 'BlogAuthorPostsPlugin', language='en')
|
||||
plugin.authors.add(self.user)
|
||||
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
||||
context = RequestContext(request, {})
|
||||
context = RequestContext(request, {'request': request})
|
||||
rendered = plugin.render_plugin(context, ph)
|
||||
self.assertTrue(rendered.find(reverse('djangocms_blog:posts-author', kwargs={'username': self.user.get_username()})) > -1)
|
||||
self.assertTrue(rendered.find('2 articles') > -1)
|
||||
|
@ -81,7 +81,7 @@ class PluginTest(BaseTest):
|
|||
ph = page1.placeholders.get(slot='content')
|
||||
plugin = add_plugin(ph, 'BlogTagsPlugin', language='en')
|
||||
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
||||
context = RequestContext(request, {})
|
||||
context = RequestContext(request, {'request': request})
|
||||
rendered = plugin.render_plugin(context, ph).replace("\n", "")
|
||||
for tag in Tag.objects.all():
|
||||
self.assertTrue(rendered.find(reverse('djangocms_blog:posts-tagged', kwargs={'tag': tag.slug})) > -1)
|
||||
|
@ -103,7 +103,7 @@ class PluginTest(BaseTest):
|
|||
plugin = add_plugin(ph, 'BlogCategoryPlugin', language='en')
|
||||
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
||||
plugin_class = plugin.get_plugin_class_instance()
|
||||
context = plugin_class.render(RequestContext(request, {}), plugin, ph)
|
||||
context = plugin_class.render(RequestContext(request, {'request': request}), plugin, ph)
|
||||
self.assertTrue(context['categories'])
|
||||
self.assertEqual(list(context['categories']), [self.category_1])
|
||||
|
||||
|
@ -118,12 +118,12 @@ class PluginTest(BaseTest):
|
|||
plugin = add_plugin(ph, 'BlogArchivePlugin', language='en')
|
||||
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
||||
plugin_class = plugin.get_plugin_class_instance()
|
||||
context = plugin_class.render(RequestContext(request, {}), plugin, ph)
|
||||
context = plugin_class.render(RequestContext(request, {'request': request}), plugin, ph)
|
||||
self.assertEqual(context['dates'][0]['date'].date(), now().replace(year=now().year, month=now().month, day=1).date())
|
||||
self.assertEqual(context['dates'][0]['count'], 2)
|
||||
|
||||
post2.publish = False
|
||||
post2.save()
|
||||
context = plugin_class.render(RequestContext(request, {}), plugin, ph)
|
||||
context = plugin_class.render(RequestContext(request, {'request': request}), plugin, ph)
|
||||
self.assertEqual(context['dates'][0]['date'].date(), now().replace(year=now().year, month=now().month, day=1).date())
|
||||
self.assertEqual(context['dates'][0]['count'], 1)
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -1,5 +1,5 @@
|
|||
[tox]
|
||||
envlist = py{26}-django{16}-cms{30,31,32},py{27,33,34}-django{16,17}-cms{30,31,32},isort,pep8
|
||||
envlist = py{26}-django{16}-cms{30,31,32},py{27,33,34}-django{16,17,18}-cms{30,31,32},isort,pep8
|
||||
|
||||
[testenv]
|
||||
commands = {env:COMMAND:python} setup.py test
|
||||
|
@ -7,9 +7,11 @@ deps =
|
|||
django16: Django>=1.6,<1.7
|
||||
django17: Django>=1.7,<1.8
|
||||
django18: Django>=1.7,<1.9
|
||||
django18: https://github.com/stefanfoulis/django-filer/archive/develop.zip
|
||||
cms30: https://github.com/divio/django-cms/archive/support/3.0.x.zip
|
||||
cms31: https://github.com/divio/django-cms/archive/support/3.1.x.zip
|
||||
cms32: https://github.com/divio/django-cms/archive/develop.zip
|
||||
https://github.com/nephila/djangocms-helper/archive/develop.zip
|
||||
py26: unittest2
|
||||
-r{toxinidir}/requirements-test.txt
|
||||
|
||||
|
|
Loading…
Reference in a new issue