diff --git a/README.md b/README.md
index 8eec091..c111302 100644
--- a/README.md
+++ b/README.md
@@ -17,8 +17,8 @@ adding some additional functionality, such as images.
Requires
----------------
-* django-cms >= 2.4
-* django >= 1.4
+* django-cms >= 3.3
+* django >= 1.8
* djangocms-text-ckeditor >= 2.0
diff --git a/cmsplugin_newsplus/cms_app.py b/cmsplugin_newsplus/cms_apps.py
similarity index 66%
rename from cmsplugin_newsplus/cms_app.py
rename to cmsplugin_newsplus/cms_apps.py
index 92b029b..5eb55c2 100644
--- a/cmsplugin_newsplus/cms_app.py
+++ b/cmsplugin_newsplus/cms_apps.py
@@ -7,8 +7,11 @@
class NewsAppHook(CMSApp):
+ app_name = 'cmsplugin_newsplus'
name = _('News App')
- urls = []
+
+ def get_urls(self, page=None, language=None, **kwargs):
+ return ['cmsplugin_newsplus.urls']
menus = [NewsItemMenu]
diff --git a/cmsplugin_newsplus/feeds.py b/cmsplugin_newsplus/feeds.py
index f3854dc..4f0a9cd 100644
--- a/cmsplugin_newsplus/feeds.py
+++ b/cmsplugin_newsplus/feeds.py
@@ -14,7 +14,7 @@ class NewsFeed(Feed):
@property
def link(self):
- return reverse('news_archive_index')
+ return reverse('cmsplugin_newsplus:news_archive_index')
def items(self):
return models.News.published.all()[:settings.FEED_SIZE]
diff --git a/cmsplugin_newsplus/models.py b/cmsplugin_newsplus/models.py
index da40e06..ef4e095 100644
--- a/cmsplugin_newsplus/models.py
+++ b/cmsplugin_newsplus/models.py
@@ -61,7 +61,7 @@ def get_absolute_url(self):
if settings.LINK_AS_ABSOLUTE_URL and self.link:
if settings.USE_LINK_ON_EMPTY_CONTENT_ONLY and not self.content:
return self.link
- return reverse('news_detail',
+ return reverse('cmsplugin_newsplus:news_detail',
kwargs={'year': self.pub_date.strftime("%Y"),
'month': self.pub_date.strftime("%m"),
'day': self.pub_date.strftime("%d"),
diff --git a/cmsplugin_newsplus/navigation.py b/cmsplugin_newsplus/navigation.py
index 6e1473d..ab4e336 100644
--- a/cmsplugin_newsplus/navigation.py
+++ b/cmsplugin_newsplus/navigation.py
@@ -26,10 +26,11 @@ def get_nodes(request):
if date.year not in years_done:
years_done.append(date.year)
- year_node = NavigationNode(date.year,
- reverse('news_archive_year',
- kwargs=dict(year=date.year)),
- 'newsitem-year-%d' % (date.year,))
+ year_node = NavigationNode(
+ date.year,
+ reverse('cmsplugin_newsplus:news_archive_year',
+ kwargs=dict(year=date.year)),
+ 'newsitem-year-%d' % (date.year,))
year_node.childrens = []
months_done = []
res.append(year_node)
@@ -38,7 +39,7 @@ def get_nodes(request):
months_done.append(date.month)
month_node = NavigationNode(
datetime.strftime(date, '%B'),
- reverse('news_archive_month', kwargs=dict(
+ reverse('cmsplugin_newsplus:news_archive_month', kwargs=dict(
year=date.year,
month=datetime.strftime(date, '%m'))),
'newsitem-month-%d.%d' % (
@@ -52,12 +53,11 @@ def get_nodes(request):
days_done.append(date.day)
day_node = NavigationNode(
datetime.strftime(date, '%d'),
- reverse('news_archive_day', kwargs=dict(
+ reverse('cmsplugin_newsplus:news_archive_day', kwargs=dict(
year=date.year,
month=datetime.strftime(date, '%m'),
day=datetime.strftime(date, '%d'))),
- 'newsitem-day-%d.%d.%d' % (date.year, date.month, date.day)
- )
+ 'newsitem-day-%d.%d.%d' % (date.year, date.month, date.day))
day_node.childrens = []
slug_done = []
month_node.childrens.append(day_node)
diff --git a/cmsplugin_newsplus/templates/cmsplugin_newsplus/news_archive_year.html b/cmsplugin_newsplus/templates/cmsplugin_newsplus/news_archive_year.html
index a7b0ed4..29e094b 100644
--- a/cmsplugin_newsplus/templates/cmsplugin_newsplus/news_archive_year.html
+++ b/cmsplugin_newsplus/templates/cmsplugin_newsplus/news_archive_year.html
@@ -3,7 +3,7 @@
News for {{ year }}
{% for date in date_list %}
-
- {{ date|date:"F" }}
+ {{ date|date:"F" }}
{% empty %}
- No news for this year
diff --git a/cmsplugin_newsplus/urls.py b/cmsplugin_newsplus/urls.py
index 18b0af7..2365d2f 100644
--- a/cmsplugin_newsplus/urls.py
+++ b/cmsplugin_newsplus/urls.py
@@ -3,7 +3,7 @@
from . import feeds
from . import views
-
+app_name = 'cmsplugin_newsplus'
urlpatterns = [
url(r'^$',
views.ArchiveIndexView.as_view(), name='news_archive_index'),
diff --git a/manage.py b/manage.py
index d1301d3..29ba849 100755
--- a/manage.py
+++ b/manage.py
@@ -3,9 +3,20 @@
import sys
if __name__ == "__main__":
- os.environ.setdefault(
- "DJANGO_SETTINGS_MODULE", "tests.settings")
-
- from django.core.management import execute_from_command_line
-
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings")
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError:
+ # The above import may fail for some other reason. Ensure that the
+ # issue is really that Django is missing to avoid masking other
+ # exceptions on Python 2.
+ try:
+ import django # noqa
+ except ImportError:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ )
+ raise
execute_from_command_line(sys.argv)
diff --git a/setup.py b/setup.py
index 62afa7a..39a1a37 100644
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,7 @@
include_package_data=True,
install_requires=[
'Django<2.0',
- 'django-cms >= 2.4',
+ 'django-cms >= 3.3',
'djangocms-text-ckeditor >= 2.0',
'Pillow',
],
diff --git a/tests/__init__.py b/test_project/__init__.py
similarity index 100%
rename from tests/__init__.py
rename to test_project/__init__.py
diff --git a/test_project/settings.py b/test_project/settings.py
new file mode 100644
index 0000000..6953b40
--- /dev/null
+++ b/test_project/settings.py
@@ -0,0 +1,140 @@
+"""
+Django settings for test_project project.
+
+Generated by 'django-admin startproject' using Django 1.11.8.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.11/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.11/ref/settings/
+"""
+
+import os
+
+from django.utils.translation import ugettext_lazy as _
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'aw006s7z(f9g&o14ud6!q%-=eqt*8=%t+g%9%o_px6g7sh5u&8'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+SITE_ID = 1
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ 'django.contrib.sites',
+ 'djangocms_text_ckeditor',
+ 'cms',
+ 'menus',
+ 'treebeard',
+ 'cmsplugin_newsplus',
+]
+
+MIDDLEWARE = [
+ 'django.middleware.security.SecurityMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'test_project.urls'
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = 'test_project.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ 'NAME': (
+ 'django.contrib.auth.password_validation.'
+ 'UserAttributeSimilarityValidator'),
+ },
+ {
+ 'NAME': (
+ 'django.contrib.auth.password_validation.'
+ 'MinimumLengthValidator'),
+ },
+ {
+ 'NAME': (
+ 'django.contrib.auth.password_validation.'
+ 'CommonPasswordValidator'),
+ },
+ {
+ 'NAME': (
+ 'django.contrib.auth.password_validation.'
+ 'NumericPasswordValidator'),
+ },
+]
+
+# Internationalization
+# https://docs.djangoproject.com/en/1.11/topics/i18n/
+
+LANGUAGES = [
+ ('en', _('English')),
+]
+
+LANGUAGE_CODE = 'en'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.11/howto/static-files/
+
+STATIC_URL = '/static/'
diff --git a/test_project/urls.py b/test_project/urls.py
new file mode 100644
index 0000000..f053076
--- /dev/null
+++ b/test_project/urls.py
@@ -0,0 +1,22 @@
+"""test_project URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/1.11/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.conf.urls import url, include
+ 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
+"""
+from django.conf.urls import url, include
+
+urlpatterns = [
+ url(r'^', include(
+ 'cmsplugin_newsplus.urls',
+ namespace='cmsplugin_newsplus')),
+]
diff --git a/test_project/wsgi.py b/test_project/wsgi.py
new file mode 100644
index 0000000..4c57701
--- /dev/null
+++ b/test_project/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for test_project project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings")
+
+application = get_wsgi_application()
diff --git a/tests/settings.py b/tests/settings.py
deleted file mode 100644
index ea52a4f..0000000
--- a/tests/settings.py
+++ /dev/null
@@ -1,183 +0,0 @@
-import os
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
-ADMINS = (
- # ('Your Name', 'your_email@example.com'),
-)
-
-MANAGERS = ADMINS
-
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': ':memory:',
- 'TEST_NAME': ':memory:',
- },
-}
-
-# Hosts/domain names that are valid for this site; required if DEBUG is False
-# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
-ALLOWED_HOSTS = []
-
-# Local time zone for this installation. Choices can be found here:
-# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
-# although not all choices may be available on all operating systems.
-# In a Windows environment this must be set to your system time zone.
-TIME_ZONE = 'America/Chicago'
-
-# Language code for this installation. All choices can be found here:
-# http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = 'en-us'
-
-SITE_ID = 1
-
-# If you set this to False, Django will make some optimizations so as not
-# to load the internationalization machinery.
-USE_I18N = True
-
-# If you set this to False, Django will not format dates, numbers and
-# calendars according to the current locale.
-USE_L10N = True
-
-# If you set this to False, Django will not use timezone-aware datetimes.
-USE_TZ = True
-
-# Absolute filesystem path to the directory that will hold user-uploaded files.
-# Example: "/var/www/example.com/media/"
-MEDIA_ROOT = ''
-
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
-# trailing slash.
-# Examples: "http://example.com/media/", "http://media.example.com/"
-MEDIA_URL = ''
-
-# Absolute path to the directory static files should be collected to.
-# Don't put anything in this directory yourself; store your static files
-# in apps' "static/" subdirectories and in STATICFILES_DIRS.
-# Example: "/var/www/example.com/static/"
-STATIC_ROOT = ''
-
-# URL prefix for static files.
-# Example: "http://example.com/static/", "http://static.example.com/"
-STATIC_URL = '/static/'
-
-# Additional locations of static files
-STATICFILES_DIRS = (
- # Put strings here, like "/home/html/static" or "C:/www/django/static".
- # Always use forward slashes, even on Windows.
- # Don't forget to use absolute paths, not relative paths.
-)
-
-# List of finder classes that know how to find static files in
-# various locations.
-STATICFILES_FINDERS = (
- 'django.contrib.staticfiles.finders.FileSystemFinder',
- 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
-)
-
-# Make this unique, and don't share it with anybody.
-SECRET_KEY = '6e-b#&0y4mbwu=)hx7a899p(k+i48(p)@e@^aal8^$pn1xqk$$'
-
-TEMPLATES = [
- {
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [
- os.path.join(os.path.dirname(__file__), 'templates'),
- ],
- 'OPTIONS': {
- 'debug': DEBUG,
- 'context_processors': [
- 'django.contrib.auth.context_processors.auth',
- 'django.core.context_processors.i18n',
- 'django.core.context_processors.request',
- 'django.core.context_processors.media',
- 'django.core.context_processors.static',
- 'cms.context_processors.cms_settings',
- 'sekizai.context_processors.sekizai',
- ],
- 'loaders': [
- 'django.template.loaders.filesystem.Loader',
- 'django.template.loaders.app_directories.Loader',
- ]
- },
- },
-]
-
-MIDDLEWARE_CLASSES = (
- 'django.middleware.common.CommonMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.middleware.csrf.CsrfViewMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'django.contrib.messages.middleware.MessageMiddleware',
- # Uncomment the next line for simple clickjacking protection:
- # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
-)
-
-ROOT_URLCONF = 'cmsplugin_newsplus.urls'
-
-# Python dotted path to the WSGI application used by Django's runserver.
-WSGI_APPLICATION = 'cmsplugin_newsplus.wsgi.application'
-
-INSTALLED_APPS = (
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.sites',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'djangocms_text_ckeditor',
- 'cms',
- 'menus',
- 'treebeard',
- 'cmsplugin_newsplus',
- # Uncomment the next line to enable the admin:
- # 'django.contrib.admin',
- # Uncomment the next line to enable admin documentation:
- # 'django.contrib.admindocs',
-)
-
-
-MIGRATION_MODULES = {
- 'djangocms_file': 'djangocms_file.migrations_django',
- 'djangocms_flash': 'djangocms_flash.migrations_django',
- 'djangocms_googlemap': 'djangocms_googlemap.migrations_django',
- 'djangocms_inherit': 'djangocms_inherit.migrations_django',
- 'djangocms_link': 'djangocms_link.migrations_django',
- 'djangocms_picture': 'djangocms_picture.migrations_django',
- 'djangocms_snippet': 'djangocms_snippet.migrations_django',
- 'djangocms_teaser': 'djangocms_teaser.migrations_django',
- 'djangocms_video': 'djangocms_video.migrations_django',
-}
-
-# A sample logging configuration. The only tangible logging
-# performed by this configuration is to send an email to
-# the site admins on every HTTP 500 error when DEBUG=False.
-# See http://docs.djangoproject.com/en/dev/topics/logging for
-# more details on how to customize your logging configuration.
-LOGGING = {
- 'version': 1,
- 'disable_existing_loggers': False,
- 'filters': {
- 'require_debug_false': {
- '()': 'django.utils.log.RequireDebugFalse'
- }
- },
- 'handlers': {
- 'mail_admins': {
- 'level': 'ERROR',
- 'filters': ['require_debug_false'],
- 'class': 'django.utils.log.AdminEmailHandler'
- }
- },
- 'loggers': {
- 'django.request': {
- 'handlers': ['mail_admins'],
- 'level': 'ERROR',
- 'propagate': True,
- },
- }
-}
-
-TEST_RUNNER = 'django.test.runner.DiscoverRunner'