From 7141697871bf018fbac24f43d6ebac040ba3396b Mon Sep 17 00:00:00 2001 From: Slavik Svyrydiuk Date: Fri, 4 Nov 2016 17:07:10 +0100 Subject: [PATCH] remove Django 1.6 and 1.7 support version 0.9.0 --- .gitignore | 4 +- Changelog | 4 ++ django_markdown/__init__.py | 2 +- django_markdown/tests.py | 3 +- django_markdown/urls.py | 14 ++--- docs/index.rst | 104 ++++++++++++++++++++++++------------ setup.py | 2 - tests/__init__.py | 12 ++--- tests/settings.py | 2 + tests/urls.py | 15 ++---- tox.ini | 24 ++++----- 11 files changed, 102 insertions(+), 84 deletions(-) diff --git a/.gitignore b/.gitignore index b28c97e..dcff5f9 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,6 @@ todo.txt .coverage .tox/ -django_markdown.egg-info/ +.cache/ +.eggs/ +django_markdown_app.egg-info/ diff --git a/Changelog b/Changelog index c813f7f..5ae4f0c 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,7 @@ +2016-11-04 sv0 + * Remove Django 1.6 and 1.7 support + * Version 0.9.0 + 2016-07-24 sv0 * Add Django 1.10 support diff --git a/django_markdown/__init__.py b/django_markdown/__init__.py index 22d18f1..f032392 100644 --- a/django_markdown/__init__.py +++ b/django_markdown/__init__.py @@ -1,6 +1,6 @@ """ Django-Markdown supports markdown in Django. """ -__version__ = "0.8.6" +__version__ = "0.9.0" __project__ = "django-markdown-app" __author__ = "Kirill Klenov " __license__ = "GNU LGPL" diff --git a/django_markdown/tests.py b/django_markdown/tests.py index 5883448..7860416 100644 --- a/django_markdown/tests.py +++ b/django_markdown/tests.py @@ -62,8 +62,7 @@ def test_preview_MARKDOWN_PROTECT_PREVIEW(self): from . import settings settings.MARKDOWN_PROTECT_PREVIEW = True - response = self.client.get('/markdown/preview/', data=self.data) - + response = self.client.post('/markdown/preview/', data=self.data) self.assertEqual(response.status_code, 302) # for tests isolation reasons diff --git a/django_markdown/urls.py b/django_markdown/urls.py index cebe911..b314c5a 100644 --- a/django_markdown/urls.py +++ b/django_markdown/urls.py @@ -1,18 +1,10 @@ """ Define preview URL. """ -from django import VERSION from django.conf.urls import url from .views import preview -if VERSION >= (1, 8): - urlpatterns = [ - url('preview/$', preview, name='django_markdown_preview') - ] -else: - # django <= 1.7 compatibility - from django.conf.urls import patterns - urlpatterns = patterns( - '', url('preview/$', preview, name='django_markdown_preview') - ) +urlpatterns = [ + url('preview/$', preview, name='django_markdown_preview') +] diff --git a/docs/index.rst b/docs/index.rst index 84375da..9f9aa3e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,7 @@ -django-markdown-app -################### +Django-Markdown v. 0.9.0 +######################## + +.. _description: **Django markdown** is django application that allows use markdown wysiwyg in flatpages, admin forms and other forms. Documentaton available at pypi_ or github_. @@ -11,11 +13,13 @@ The reason of forking is the original project is not maintained anymore and the .. contents:: +.. _requirements: + Requirements ============ -- python >= 2.5 -- django >= 1.2 +- python >= 2.7 +- django >= 1.8 - markdown @@ -30,6 +34,9 @@ Installation Setup ===== +.. note:: 'django_markdown' require 'django.contrib.staticfiles' in INSTALLED_APPS + + - Add 'django_markdown' to INSTALLED_APPS :: INSTALLED_APPS += ( 'django_markdown', ) @@ -43,16 +50,40 @@ Setup Use django_markdown =================== +#) Models: :: + + from django_markdown.models import MarkdownField + + + class MyModel(models.Model): + content = MarkdownField() + + #) Custom forms: :: + from django_markdown.fields import MarkdownFormField from django_markdown.widgets import MarkdownWidget + + class MyCustomForm(forms.Form): - content = forms.CharField( widget=MarkdownWidget() ) + content = forms.CharField(widget=MarkdownWidget()) + content2 = MarkdownFormField() + #) Custom admins: :: from django_markdown.admin import MarkdownModelAdmin - adimin.site.register(MyModel, MarkdownModelAdmin) + admin.site.register(MyModel, MarkdownModelAdmin) + + +#) Admin Overrides: (If you don't want to subclass package ModelAdmin's) :: + + from django.contrib import admin + + + class YourModelAdmin(admin.ModelAdmin): + formfield_overrides = {MarkdownField: {'widget': AdminMarkdownWidget}} + #) Flatpages: :: @@ -64,45 +95,48 @@ Use django_markdown flatpages.register() urlpatterns += [ url(r'^admin/', include(admin.site.urls)), ] -#) JavaScript API: :: - - // Editors manager ``miu`` methods +#) Template tags: :: - // Initialize editor using default settings extended with ``extraSettings`` - miu.init(textareaId, extraSettings); + + {% markdown_editor "#new" %} + {% markdown_media %} - // Get default mIu settings - miu.settings(); - - // Set default mIu settings - miu.settings(newSettings); - - // Get all initialized aditors - miu.editors(); - - // Get certain editor - miu.editors(textareaId); - - - // Editor instance methods - - // Dynamically add button at ``index`` position - editor.addButton(conf, index) - - // Dynamically remove button at ``index`` position - editor.removeButton(index) - Settings ======== +**MARKDOWN_EDITOR_SETTINGS** - holds the extra parameters set to be passed to ``textarea.markItUp()`` + **MARKDOWN_EDITOR_SKIN** - skin option, default value is ``markitup`` Example: `settings.py` :: MARKDOWN_EDITOR_SKIN = 'simple' -**MARKDOWN_EDITOR_SETTINGS** - holds the extra parameters set to be passed to textarea.markItUp() +**MARKDOWN_EXTENSIONS** - optional list of extensions passed to Markdown, discussed at https://pythonhosted.org/Markdown/extensions/index.html#officially-supported-extensions + +Example: `settings.py` :: + + MARKDOWN_EXTENSIONS = ['extra'] + +**MARKDOWN_EXTENSION_CONFIGS** - Configure extensions, discussed at https://pythonhosted.org/Markdown/reference.html#extension_configs + +**MARKDOWN_PREVIEW_TEMPLATE** - Template for preview a markdown. By default `django_markdown/preview.css` + +**MARKDOWN_STYLE** - path to preview styles. By default `django_markdown/preview.css` + +**MARKDOWN_SET_PATH** - path to folder with sets. By default `django_markdown/sets` + +**MARKDOWN_SET_NAME** - name for current set. By default `markdown`. + +**MARKDOWN_PROTECT_PREVIEW** - protect preview url for staff only + + +Examples +======== + +Execute `make run` in sources directory. Open http://127.0.0.1:8000 in your +browser. For admin access use 'root:root' credentials. Changes @@ -128,11 +162,11 @@ Development of django-markdown-app happens at github: https://github.com/sv0/dja Contributors -============= +============ * klen_ (Kirill Klenov) -* yavorskiy_ (Sergii Iavorskyi) +* yavorskiy_ (Sergii Iavorskyi) License diff --git a/setup.py b/setup.py index f4255e8..5234b9d 100644 --- a/setup.py +++ b/setup.py @@ -49,8 +49,6 @@ def _read(fname): keywords='html markdown django', classifiers=[ 'Development Status :: 5 - Production/Stable', - 'Framework :: Django :: 1.6', - 'Framework :: Django :: 1.7', 'Framework :: Django :: 1.8', 'Framework :: Django :: 1.9', 'Framework :: Django :: 1.10', diff --git a/tests/__init__.py b/tests/__init__.py index 54c6ad3..1a22102 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,18 +1,14 @@ import os -from django import VERSION from django.core.management import call_command os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tests.settings') -if VERSION >= (1, 7): - from django.conf import settings - from django.apps import apps +from django.conf import settings +from django.apps import apps - apps.populate(settings.INSTALLED_APPS) - call_command('migrate', interactive=False) -else: - call_command('syncdb', interactive=False) +apps.populate(settings.INSTALLED_APPS) +call_command('migrate', interactive=False) from django_markdown.tests import * # noqa diff --git a/tests/settings.py b/tests/settings.py index 21d0104..b44d23f 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -13,6 +13,8 @@ MEDIA_ROOT = TMPDIR +ALLOWED_HOSTS = ['*'] + DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', diff --git a/tests/urls.py b/tests/urls.py index da406e5..a8aba19 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -1,14 +1,5 @@ -from django import VERSION from django.conf.urls import include, url -if VERSION >= (1, 8): - urlpatterns = [ - url(r'^markdown/', include('django_markdown.urls')), - ] -else: - # django <= 1.7.* - from django.conf.urls import patterns - urlpatterns = patterns( - '', - (r'^markdown/', include('django_markdown.urls')), - ) +urlpatterns = [ + url(r'^markdown/', include('django_markdown.urls')), +] diff --git a/tox.ini b/tox.ini index 19c7694..0546a64 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=py27-d16,py27-d17,py34-d17,py34-d110,cov +envlist=py27-d18,py27-d19,py27-d110,py35-d18,py35-d19,py35-d110,cov [pylama] skip=example/* @@ -26,35 +26,35 @@ commands=py.test deps = pytest -[testenv:py27-d16] +[testenv:py27-d18] basepython = python2.7 deps = - django==1.6.7 + django==1.8.15 {[testenv]deps} -[testenv:py27-d17] +[testenv:py27-d19] basepython = python2.7 deps = - django==1.7 + django==1.9.10 {[testenv]deps} -[testenv:py34-d17] -basepython = python3.4 +[testenv:py35-d18] +basepython = python3.5 deps = - django==1.7 + django==1.8.15 {[testenv]deps} -[testenv:py34-d110] -basepython = python3.4 +[testenv:py35-d110] +basepython = python3.5 deps = - django==1.10 + django==1.10.2 {[testenv]deps} [testenv:cov] deps = coverage==4.1 - django==1.10 + django==1.10.2 {[testenv]deps} commands =