[Python-modules-commits] [django-markupfield] 01/05: Import django-markupfield_1.4.2.orig.tar.gz
Michael Fladischer
fladi at moszumanska.debian.org
Tue Jun 20 07:39:00 UTC 2017
This is an automated email from the git hooks/post-receive script.
fladi pushed a commit to branch master
in repository django-markupfield.
commit ec9d6886f2863a42a704212d79fca30ee3f8cb0e
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date: Tue Jun 20 09:32:11 2017 +0200
Import django-markupfield_1.4.2.orig.tar.gz
---
CHANGELOG | 92 ---------------------------------
PKG-INFO | 11 +++-
README.rst | 9 ++++
django_markupfield.egg-info/PKG-INFO | 11 +++-
django_markupfield.egg-info/SOURCES.txt | 1 -
django_markupfield.egg-info/pbr.json | 2 +-
markupfield/__init__.py | 2 +-
markupfield/fields.py | 2 +-
markupfield/tests/models.py | 3 ++
markupfield/tests/tests.py | 28 +++++++++-
setup.py | 2 +-
11 files changed, 63 insertions(+), 100 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
deleted file mode 100644
index 07aed04..0000000
--- a/CHANGELOG
+++ /dev/null
@@ -1,92 +0,0 @@
-1.4.1 - 6 October 2016
-======================
- - compatibility tweaks for Django 1.9 and 1.10
-
-1.4.0 - 17 December 2015
-=========================
- - bugfixes for Django 1.9
- - drop support for deprecated Django versions
-
-1.3.5 - 21 May 2015
-===================
- - properly handle null=True
-
-1.3.4 - 29 April 2015
-=====================
- - Fix for an issue where __proxy__ objects interfere w/ widget rendering.
-
-1.3.3 - 21 April 2015
-=====================
- - Add test for issue fixed in last release: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-0846
- Further documented here: https://www.djangoproject.com/weblog/2015/apr/21/docutils-security-advisory/
-
-1.3.2 - 16 April 2015
-=====================
- - Fix for an issue with ReST, thanks to Markus Holtermann
-
-1.3.1 - 15 April 2015
-=====================
- - Fix translation support to be lazy, thanks to Michael Kutý
-
-1.3.0 - 22 February 2015
-========================
- - Django 1.7 migration support, thanks to Frank Wiles
- - dedicated option for titles in markup choice field thanks to Markus Holtermann
- - fix for latest version of markdown library
-
-1.2.1 - 10 July 2014
-====================
- - value_to_string check, fixing #16
- - urllize & linebreak fix, fixing #18
- - fix for __unicode__, fixing #9
-
-1.2.0 - 22 July 2013
-====================
- - drop support for markup_choices being a dict entirely
- - PEP8 compliance
- - bugfix for default 'plain' markup type that escapes HTML
-
-1.1.1 - 16 March 2013
-=====================
- - experimental Python 3 support with Django 1.5
- - drop support for Django 1.3/Python 2.5
- - markup_choices can no longer be a dict (deprecated pre-1.0)
-
-1.1.0 - bad release, ignore
-=============================
-
-1.0.2 - 25 March 2011
-=====================
- - fix Django 1.3 DeprecationWarning
-
-1.0.1 - 28 Feb 2011
-===================
- - added a fix for MarkupField to work with South >= 0.7
-
-1.0.0 - 1 Feb 2011
-==================
- - added markup_choices option to MarkupField
- - switch to tuple/list for setting markup_type, dict deprecated
- - split markup detection into markupfield.markup
- - escape_html option
-
-0.3.1 - January 28 2010
-=======================
- - fix bug when adding a MarkupField to an abstract model (github issue #1)
-
-0.3.0 - October 23 2009
-=======================
- - enable pygments support by default if it is installed
-
-0.2.0 - August 3 2009
-=====================
- - fixed bug with using MarkupField widgets on postgres backend
- - correctly check markup_type when doing pre_save
-
-0.1.2 - July 7 2009
-===================
- - fixed bug with using MarkupField on postgres backend
-
-0.1.0
-=====
- - initial working release
diff --git a/PKG-INFO b/PKG-INFO
index d18ce2d..5bffd6a 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: django-markupfield
-Version: 1.4.1
+Version: 1.4.2
Summary: Custom Django field for easy use of markup in text fields
Home-page: http://github.com/jamesturk/django-markupfield/
Author: James Turk
@@ -189,6 +189,15 @@ Description: ==================
assignment to ``a.body_markup_type`` is equivalent to assignment to
``a.body.markup_type``.
+ .. important::
+ Keeping in mind that ``body`` is MarkupField instance is particullary important with ``default`` or ``default_if_none`` filter for model that could be blank. If ``body``'s ``rendered`` is ``None`` or empty string (``""``) these filters will *not* evaluate ``body`` as falsy to display default text::
+
+ {{ a.body|default:"<missing body>" }}
+
+ That's because ``body`` is regular non-``None`` MarkupField instance. To let ``default`` or ``default_if_none`` filters to work evaluate ``rendered`` MarkupField attribute instead. To prevent escaping HTML for the case ``rendered`` is truethy, finish chain with ``safe`` filter::
+
+ {{ a.body.rendered|default:"<missing body>"|safe }}
+
.. note::
a.body.rendered is only updated when a.save() is called
diff --git a/README.rst b/README.rst
index 47ecbae..c4cec11 100644
--- a/README.rst
+++ b/README.rst
@@ -181,6 +181,15 @@ Assignment to ``a.body`` is equivalent to assignment to ``a.body.raw`` and
assignment to ``a.body_markup_type`` is equivalent to assignment to
``a.body.markup_type``.
+.. important::
+ Keeping in mind that ``body`` is MarkupField instance is particullary important with ``default`` or ``default_if_none`` filter for model that could be blank. If ``body``'s ``rendered`` is ``None`` or empty string (``""``) these filters will *not* evaluate ``body`` as falsy to display default text::
+
+ {{ a.body|default:"<missing body>" }}
+
+ That's because ``body`` is regular non-``None`` MarkupField instance. To let ``default`` or ``default_if_none`` filters to work evaluate ``rendered`` MarkupField attribute instead. To prevent escaping HTML for the case ``rendered`` is truethy, finish chain with ``safe`` filter::
+
+ {{ a.body.rendered|default:"<missing body>"|safe }}
+
.. note::
a.body.rendered is only updated when a.save() is called
diff --git a/django_markupfield.egg-info/PKG-INFO b/django_markupfield.egg-info/PKG-INFO
index d18ce2d..5bffd6a 100644
--- a/django_markupfield.egg-info/PKG-INFO
+++ b/django_markupfield.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: django-markupfield
-Version: 1.4.1
+Version: 1.4.2
Summary: Custom Django field for easy use of markup in text fields
Home-page: http://github.com/jamesturk/django-markupfield/
Author: James Turk
@@ -189,6 +189,15 @@ Description: ==================
assignment to ``a.body_markup_type`` is equivalent to assignment to
``a.body.markup_type``.
+ .. important::
+ Keeping in mind that ``body`` is MarkupField instance is particullary important with ``default`` or ``default_if_none`` filter for model that could be blank. If ``body``'s ``rendered`` is ``None`` or empty string (``""``) these filters will *not* evaluate ``body`` as falsy to display default text::
+
+ {{ a.body|default:"<missing body>" }}
+
+ That's because ``body`` is regular non-``None`` MarkupField instance. To let ``default`` or ``default_if_none`` filters to work evaluate ``rendered`` MarkupField attribute instead. To prevent escaping HTML for the case ``rendered`` is truethy, finish chain with ``safe`` filter::
+
+ {{ a.body.rendered|default:"<missing body>"|safe }}
+
.. note::
a.body.rendered is only updated when a.save() is called
diff --git a/django_markupfield.egg-info/SOURCES.txt b/django_markupfield.egg-info/SOURCES.txt
index 52f149d..1bc032f 100644
--- a/django_markupfield.egg-info/SOURCES.txt
+++ b/django_markupfield.egg-info/SOURCES.txt
@@ -1,5 +1,4 @@
AUTHORS.txt
-CHANGELOG
LICENSE
MANIFEST.in
README.rst
diff --git a/django_markupfield.egg-info/pbr.json b/django_markupfield.egg-info/pbr.json
index 2568d2e..378b5b1 100644
--- a/django_markupfield.egg-info/pbr.json
+++ b/django_markupfield.egg-info/pbr.json
@@ -1 +1 @@
-{"is_release": true, "git_version": "452d421"}
\ No newline at end of file
+{"is_release": false, "git_version": "3c7d7b6"}
\ No newline at end of file
diff --git a/markupfield/__init__.py b/markupfield/__init__.py
index 8e3c933..98d186b 100644
--- a/markupfield/__init__.py
+++ b/markupfield/__init__.py
@@ -1 +1 @@
-__version__ = '1.4.1'
+__version__ = '1.4.2'
diff --git a/markupfield/fields.py b/markupfield/fields.py
index a4179b0..f190d26 100644
--- a/markupfield/fields.py
+++ b/markupfield/fields.py
@@ -125,7 +125,7 @@ class MarkupField(models.TextField):
blank=False if self.default_markup_type else True,
null=False if self.default_markup_type else True,
)
- rendered_field = models.TextField(editable=False, null=self.null)
+ rendered_field = models.TextField(editable=False, null=self.null, default=self.default)
markup_type_field.creation_counter = self.creation_counter + 1
rendered_field.creation_counter = self.creation_counter + 2
cls.add_to_class(_markup_type_field_name(name), markup_type_field)
diff --git a/markupfield/tests/models.py b/markupfield/tests/models.py
index ce17c61..eeb17bd 100644
--- a/markupfield/tests/models.py
+++ b/markupfield/tests/models.py
@@ -42,3 +42,6 @@ class NullTestModel(models.Model):
class DefaultTestModel(models.Model):
text = MarkupField(null=True, default="**nice**", default_markup_type="markdown")
+
+class NullDefaultTestModel(models.Model):
+ text = MarkupField(null=False, blank=True, default="*nice*", default_markup_type="markdown")
diff --git a/markupfield/tests/tests.py b/markupfield/tests/tests.py
index 88079bd..b66f18a 100644
--- a/markupfield/tests/tests.py
+++ b/markupfield/tests/tests.py
@@ -9,7 +9,7 @@ from django.utils.encoding import smart_text
from markupfield.markup import DEFAULT_MARKUP_TYPES
from markupfield.fields import MarkupField, Markup
from markupfield.widgets import MarkupTextarea, AdminMarkupTextareaWidget
-from markupfield.tests.models import Post, Article, Concrete, NullTestModel, DefaultTestModel
+from markupfield.tests.models import Post, Article, Concrete, NullTestModel, DefaultTestModel, NullDefaultTestModel
from django.forms.models import modelform_factory
ArticleForm = modelform_factory(Article, fields=['normal_field', 'normal_field_markup_type',
@@ -347,6 +347,17 @@ class NullTestCase(TestCase):
class DefaultTestCase(TestCase):
+ def test_default_value_rendered(self):
+ m = DefaultTestModel()
+ m.save()
+
+ self.assertEqual(
+ m._meta.get_field('_text_rendered').default,
+ m._meta.get_field('text').default
+ )
+
+ self.assertEqual(m._text_rendered, "<p><strong>nice</strong></p>")
+
def test_default_text_save(self):
m = DefaultTestModel()
m.save()
@@ -361,3 +372,18 @@ class DefaultTestCase(TestCase):
self.assertEqual(smart_text(m.text), '')
self.assertIsNone(m.text.raw)
self.assertIsNone(m.text.rendered)
+
+
+class NullDefaultTestCase(TestCase):
+ def test_default_value_rendered(self):
+ m = NullDefaultTestModel()
+ m.save()
+
+ self.assertEqual(
+ m._meta.get_field('_text_rendered').default,
+ m._meta.get_field('text').default
+ )
+
+ self.assertEqual(m._text_rendered, "<p><em>nice</em></p>")
+
+
diff --git a/setup.py b/setup.py
index b69ff43..55a6e64 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ long_description = open('README.rst').read()
setup(
name='django-markupfield',
- version="1.4.1",
+ version="1.4.2",
package_dir={'markupfield': 'markupfield'},
packages=['markupfield', 'markupfield.tests'],
package_data={'markupfield': ['locale/*/*/*']},
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-markupfield.git
More information about the Python-modules-commits
mailing list