Skip to content

Commit

Permalink
Merge: Resolve conflicts and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
vinitkumar committed Feb 24, 2020
2 parents a32366d + db9c4d4 commit 3776047
Show file tree
Hide file tree
Showing 178 changed files with 6,280 additions and 3,674 deletions.
26 changes: 23 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
*.pyc
*.py[cod]
*$py.class
*.egg-info
*.log
*.pot
.DS_Store
.coverage
.coverage/
.eggs/
.idea/
.project/
.pydevproject/
.vscode/
.settings/
.tox/
.eggs/
dist/
__pycache__/
build/
dist/
env/

/~
/node_modules
.sass-cache
*.css.map
npm-debug.log
package-lock.json

local.sqlite
48 changes: 33 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
language: python

dist: xenial
sudo: false

env:
- TOX_ENV=flake8
- TOX_ENV=py27-latest
- TOX_ENV=py34-latest
# Django 1.8
- TOX_ENV=py27-dj18-cms34
- TOX_ENV=py27-dj18-cms33
- TOX_ENV=py34-dj18-cms34
- TOX_ENV=py34-dj18-cms33
# Django 1.9
- TOX_ENV=py27-dj19-cms34
- TOX_ENV=py27-dj19-cms33
- TOX_ENV=py34-dj19-cms34
- TOX_ENV=py34-dj19-cms33
matrix:
include:
- python: 3.5
env: TOX_ENV='flake8'
- python: 3.5
env: TOX_ENV='isort'
# Django 1.11
- python: 2.7
env: DJANGO='dj111' CMS='cms34'
- python: 3.4
env: DJANGO='dj111' CMS='cms35'
- python: 3.5
env: DJANGO='dj111' CMS='cms36'
- python: 3.6
env: DJANGO='dj111' CMS='cms37'
# Django 2.1
- python: 3.6
env: DJANGO='dj21' CMS='cms36'
- python: 3.6
env: DJANGO='dj21' CMS='cms37'
# Django 2.2
- python: 3.6
env: DJANGO='dj22' CMS='cms37'
- python: 3.7
env: DJANGO='dj22' CMS='cms37'

install:
- pip install tox coverage
- pip install coverage isort tox
- "if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then export PY_VER=py27; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then export PY_VER=py34; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then export PY_VER=py35; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then export PY_VER=py36; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then export PY_VER=py37; fi"
- "if [[ ${DJANGO}z != 'z' ]]; then export TOX_ENV=$PY_VER-$DJANGO-$CMS; fi"

script:
- tox -e $TOX_ENV
Expand Down
82 changes: 81 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,87 @@ Changelog
=========


2.0.6 (unreleased)
2.4.0 (2020-01-29)
==================

* Added support for Django 3.0
* Pinned ``django-filer`` to 1.5.0
* Added further tests to raise coverage
* Fixed smaller issues found during testing
* Dropped support for django-filer <= 1.4
* Fixed alt attribute not rendering correctly


2.3.0 (2019-07-09)
==================

* Fixes an issue where ``get_link`` doesn't return external picture
* Fixes ``img_srcset_data`` being processed on an external picture
* Added tests for the plugin itself
* Updated translations


2.2.1 (2019-05-06)
==================

* Fixed a regression where external images are not shown anymore


2.2.0 (2019-04-30)
==================

* Added support for Django 2.2 and django CMS 3.7
* Removed support for Django 2.0
* Fixed an issue when the image reference is lost
* Extended test matrix
* Added isort and adapted imports
* Adapted code base to align with other supported addons


2.1.3 (2018-12-12)
==================

* Added missing migration for Picture model


2.1.2 (2018-12-06)
==================

* Fixed an issue creating a validation error on the alt attribute
* Fixed an issue in the template adding a ``}`` after the ``srcset``
* Adapted test matrix for django CMS 3.4, 3.5, 3.6 as well as
Django 1.11, 2.0 and 2.1
* Exclude ``tests`` folder from release build


2.1.1 (2018-11-14)
==================

* Added reference variables to migrations
* Fixed a text typo in models


2.1.0 (2018-11-13)
==================

* Removed support for Django 1.8, 1.9, 1.10


2.0.8 (2018-11-13)
==================

* Fixed an issue where default DJANGOCMS_PICTURE_RESPONSIVE_IMAGES was not in settings


2.0.7 (2018-10-19)
==================

* Add responsive image support
* Add support for Django 2.0 and 2.1
* Fix swappable filer image model support


2.0.6 (2017-10-12)
==================

* Fixed a misleading link to MDN inside code documentation
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include LICENSE.txt
include LICENSE
include README.rst
recursive-include djangocms_picture/templates *
recursive-include djangocms_picture/locale *
Expand Down
34 changes: 24 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
django CMS Picture
==================


|pypi| |build| |coverage|

**django CMS Picture** is a plugin for `django CMS <http://django-cms.org>`_
Expand All @@ -23,6 +22,10 @@ feedback in the form of issues and pull requests. Before submitting your
pull request, please review our `contribution guidelines
<http://docs.django-cms.org/en/latest/contributing/index.html>`_.

We're grateful to all contributors who have helped create and maintain this package.
Contributors are listed at the `contributors <https://github.com/divio/djangocms-picture/graphs/contributors>`_
section.

One of the easiest contributions you can make is helping to translate this addon on
`Transifex <https://www.transifex.com/projects/p/djangocms-picture/>`_.

Expand All @@ -33,11 +36,11 @@ Documentation
See ``REQUIREMENTS`` in the `setup.py <https://github.com/divio/djangocms-picture/blob/master/setup.py>`_
file for additional dependencies:

* Python 2.7, 3.3 or higher
* Django 1.8 or higher
* Django Filer 1.2.4 or higher
|python| |django| |djangocms|

* Django Filer 1.5.0 or higher

Make sure `django Filer <http://django-filer.readthedocs.io/en/latest/installation.html>`_
Make sure `django-filer <http://django-filer.readthedocs.io/en/latest/installation.html>`_
is installed and configured appropriately.


Expand Down Expand Up @@ -72,8 +75,7 @@ copying the ``default`` folder inside that directory and renaming it to

Another setting is ``DJANGOCMS_PICTURE_NESTING``, which allows you to render an image
as the background image of a container that also contains other content (text, icons
and so on).
::
and so on). ::

DJANGOCMS_PICTURE_NESTING = True

Expand All @@ -90,6 +92,11 @@ This will generate a class prefixed with ``align-``. The example above
would produce a ``class="align-top"``. Adding a ``class`` key to the image
attributes automatically merges the alignment with the attribute class.

You can enable responsive images technique by setting``DJANGOCMS_PICTURE_RESPONSIVE_IMAGES`` to ``True``.
In this case uploaded images will create thumbnails of different sizes according
to ``DJANGOCMS_PICTURE_RESPONSIVE_IMAGES_VIEWPORT_BREAKPOINTS`` (which defaults to ``[576, 768, 992]``) and browser
will be responsible for choosing the best image to display (based upon the screen viewport).

You can use ``DJANGOCMS_PICTURE_RATIO`` to set the width/height ratio of images
if these values are not set explicitly on the image::

Expand All @@ -112,8 +119,8 @@ when the plugin uses *Autoscale* it can discover them::
{% placeholder content %}
{% endwith %}

Further configuration can be achieved through
`django Filer <https://django-filer.readthedocs.io/en/latest/settings.html>`_.
Further configuration can be achieved through the
`django Filer settings <https://django-filer.readthedocs.io/en/latest/settings.html>`_.


Running Tests
Expand All @@ -123,7 +130,7 @@ You can run tests by executing::

virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
pip install -r test_requirements/base.txt
python setup.py test


Expand All @@ -133,3 +140,10 @@ You can run tests by executing::
:target: https://travis-ci.org/divio/djangocms-picture
.. |coverage| image:: https://codecov.io/gh/divio/djangocms-picture/branch/master/graph/badge.svg
:target: https://codecov.io/gh/divio/djangocms-picture

.. |python| image:: https://img.shields.io/badge/python-2.7%20%7C%203.4+-blue.svg
:target: https://pypi.org/project/djangocms-picture/
.. |django| image:: https://img.shields.io/badge/django-1.11%20%7C%202.1%20%7C%202.2-blue.svg
:target: https://www.djangoproject.com/
.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.4%2B-blue.svg
:target: https://www.django-cms.org/
19 changes: 17 additions & 2 deletions aldryn_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ class Form(forms.BaseForm):
required=False,
initial=False,
)
responsive_images = forms.CheckboxField(
'Enable responsive images technique',
required=False,
initial=False,
)
responsive_images_viewport_breakpoints = forms.CharField(
'List of viewport breakpoints (in pixels) for responsive images (comma separated)',
required=False,
)

def clean(self):
data = super(Form, self).clean()
Expand All @@ -36,8 +45,9 @@ def clean(self):
data['alignment'] = ', '.join(data['alignment'])

# prettify
data['templates'] = ', '.join(split_and_strip(data['templates']))
data['alignment'] = ', '.join(split_and_strip(data['alignment']))
for field in ('templates', 'alignment', 'responsive_images_viewport_breakpoints'):
data[field] = ', '.join(split_and_strip(data[field]))

return data

def to_settings(self, data, settings):
Expand All @@ -56,4 +66,9 @@ def to_settings(self, data, settings):
if data['nesting']:
settings['DJANGOCMS_PICTURE_NESTING'] = data['nesting']

settings['DJANGOCMS_PICTURE_RESPONSIVE_IMAGES'] = data.get('responsive_images', False)
breakpoints = data.get('responsive_images_viewport_breakpoints')
if breakpoints:
breakpoints = [float(x) for x in split_and_strip(breakpoints)]
settings['DJANGOCMS_PICTURE_RESPONSIVE_IMAGES_VIEWPORT_BREAKPOINTS'] = breakpoints
return settings
2 changes: 1 addition & 1 deletion djangocms_picture/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '2.0.8'
__version__ = '2.4.1'
8 changes: 5 additions & 3 deletions djangocms_picture/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool

from .models import Picture
from .forms import PictureForm
from .models import Picture


# enable nesting of plugins inside the picture plugin
Expand All @@ -31,6 +31,7 @@ class PicturePlugin(CMSPluginBase):
'classes': ('collapse',),
'fields': (
'template',
'use_responsive_image',
('width', 'height'),
'alignment',
'caption_text',
Expand Down Expand Up @@ -68,9 +69,10 @@ def render(self, context, instance, placeholder):
# assign link to a context variable to be performant
context['picture_link'] = instance.get_link()
context['picture_size'] = instance.get_size(
width=float(context.get('width') or 0),
height=float(context.get('height') or 0),
width=context.get('width') or 0,
height=context.get('height') or 0,
)
context['img_srcset_data'] = instance.img_srcset_data

return super(PicturePlugin, self).render(context, instance, placeholder)

Expand Down
Binary file modified djangocms_picture/locale/af/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit 3776047

Please sign in to comment.