Skip to content
This repository was archived by the owner on Oct 13, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]


Expand Down
2 changes: 1 addition & 1 deletion cmsplugin_newsplus/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion cmsplugin_newsplus/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
16 changes: 8 additions & 8 deletions cmsplugin_newsplus/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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' % (
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ <h1>News for {{ year }}</h1>
<ul>
{% for date in date_list %}
<li>
<a href="{% url 'news_archive_month' year=date|date:'Y' month=date|date:'m' %}">{{ date|date:"F" }}</a>
<a href="{% url 'cmsplugin_newsplus:news_archive_month' year=date|date:'Y' month=date|date:'m' %}">{{ date|date:"F" }}</a>
</li>
{% empty %}
<li>No news for this year</li>
Expand Down
2 changes: 1 addition & 1 deletion cmsplugin_newsplus/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
21 changes: 16 additions & 5 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
Expand Down
File renamed without changes.
140 changes: 140 additions & 0 deletions test_project/settings.py
Original file line number Diff line number Diff line change
@@ -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/'
22 changes: 22 additions & 0 deletions test_project/urls.py
Original file line number Diff line number Diff line change
@@ -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')),
]
16 changes: 16 additions & 0 deletions test_project/wsgi.py
Original file line number Diff line number Diff line change
@@ -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()
Loading