Skip to content

Commit

Permalink
added django 3.1 support (#417)
Browse files Browse the repository at this point in the history
* general update

* add changelog entry

* fixes #408

* potentially fixes #410

* text something

* also run docker tests

* update test structure

* adapt readme

* get localsetup to run

* let's see if that also works on travis

* update reference images

* formatting

* fix readme

* fix linting

* use references generated from Docker

* add pagetree test case

* let's see what happens on travis

* fix 3.1 rendering issues

* add css fixes

* do not render the sidenav and make sure reference files are actually used

* fixes

* revert (fails again)

* adapt version list

* fix css issues

* fix tests

* add additional adaptions

* still supported for 3.6

* renamce license file
  • Loading branch information
FinalAngel authored Aug 26, 2020
1 parent 8f16d6b commit c586847
Show file tree
Hide file tree
Showing 73 changed files with 1,454 additions and 2,179 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ npm-debug.log
package-lock.json

local.sqlite
testdb.sqlite*

tests/screenshots/*
!tests/screenshots/reference
!tests/screenshots/reference-*
!djangocms_admin_style/static/djangocms_admin_style/js/dist
46 changes: 19 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: python

dist: xenial
sudo: required

services:
- docker
Expand All @@ -12,44 +11,37 @@ matrix:
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.5
env: DJANGO='dj22' CMS='cms37'
- python: 3.6
env: DJANGO='dj22' CMS='cms37'
- python: 3.7
env: DJANGO='dj22' CMS='cms37'
allow_failures:
# Django 3.0
- python: 3.7
env: DJANGO='dj30' CMS='cms37'
- python: 3.8
env: DJANGO='dj22' CMS='cms37'
# Django 3.0, always run the lowest supported version
- python: 3.6
env: DJANGO='dj30' CMS='cms37'
# Docker
- python: 2.7
env: TOX_ENV='docker111'
- python: 3.5
env: TOX_ENV='docker21'
- python: 3.5
# Django 3.1, always run the lowest supported version
- python: 3.6
env: DJANGO='dj31' CMS='cms38'
# Screenshot tests
- python: 3.6
env: TOX_ENV='docker22'
- python: 3.6
env: TOX_ENV='docker30'
- python: 3.6
env: TOX_ENV='docker31'
allow_failures:
- python: 3.6
env: DJANGO='dj31' CMS='cms38'
- python: 3.6
env: TOX_ENV='docker31'

install:
- make build
- 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"
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ Changelog
=========


2.0.0 (unreleased)
==================

* Added support for Django 3.1
* Dropped support for Python 2.7 and Python 3.4
* Dropped support for Django < 2.2
* Changed ``field-box`` class declarations to ``fieldBox``
* Fixed screenshot tests for Django 2.2 and higher


1.5.0 (2020-01-24)
==================

Expand Down
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM python:3.6
FROM python:3.6.6

# Pillow requirements
RUN apt-get update \
&& apt-get -y install libtiff-dev libjpeg62-turbo-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev libgif-dev
&& apt-get -y install libtiff5-dev libjpeg62-turbo-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev \
build-essential

# Node setup
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs
RUN apt-get install -y build-essential
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs npm
RUN npm install -g gulp@3

# Preparing files
Expand All @@ -18,7 +18,7 @@ COPY ./package.json /app/package.json
COPY ./package-lock.json /app/package-lock.json
COPY ./tests/requirements /app/tests/requirements

RUN npm i -f
RUN npm install

CMD pip install -e . && gulp lint && gulp tests:integration

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.django22 → Dockerfile.django-2.2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ FROM djangocms-admin-style-test:base

RUN pip install -r /app/tests/requirements/django-2.2.txt

ENV SCREENSHOT_REFERENCES = "./tests/screenshots/reference_2"
ENV SCREENSHOT_REFERENCES="./tests/screenshots/reference-2.2"

COPY . /app
7 changes: 7 additions & 0 deletions Dockerfile.django-3.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM djangocms-admin-style-test:base

RUN pip install -r /app/tests/requirements/django-3.0.txt

ENV SCREENSHOT_REFERENCES="./tests/screenshots/reference-3.0"

COPY . /app
7 changes: 7 additions & 0 deletions Dockerfile.django-3.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM djangocms-admin-style-test:base

RUN pip install -r /app/tests/requirements/django-3.1.txt

ENV SCREENSHOT_REFERENCES="./tests/screenshots/reference-3.1"

COPY . /app
7 changes: 0 additions & 7 deletions Dockerfile.django111

This file was deleted.

7 changes: 0 additions & 7 deletions Dockerfile.django21

This file was deleted.

File renamed without changes.
46 changes: 19 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
PORT = 8000
VERSION = 2.2


build:
docker build -t djangocms-admin-style-test:base -f Dockerfile .

# Django 1.11
run111:
make build
docker build -t djangocms-admin-style-test:django111 -f Dockerfile.django111 .
docker run -t --rm -p $(PORT):8000 -v `pwd`:/app djangocms-admin-style-test:django111 bash -c "pip install -r tests/requirements/django-1.11.txt && python tests/settings-docker.py"

test111:
make build
docker build -t djangocms-admin-style-test:django111 -f Dockerfile.django111 .
docker run -t --rm -v `pwd`/tests/screenshots/django111:/app/tests/screenshots/results djangocms-admin-style-test:django111
cleanup:
rm -rf *testdb.sqlite

# Django 2.1
run21:
run:
make cleanup
make build
docker build -t djangocms-admin-style-test:django21 -f Dockerfile.django21 .
docker run -t --rm -p $(PORT):8000 -v `pwd`:/app djangocms-admin-style-test:django21 bash -c "pip install -r tests/requirements/django-2.1.txt && python tests/settings-docker.py"
docker build -t djangocms-admin-style-test:django-$(VERSION) -f Dockerfile.django-$(VERSION) .
docker run -t --rm -p $(PORT):8000 -v `pwd`:/app djangocms-admin-style-test:django-$(VERSION) bash -c "pip install -r tests/requirements/django-$(VERSION).txt && python tests/settings-docker.py"

test21:
test:
make build
docker build -t djangocms-admin-style-test:django21 -f Dockerfile.django21 .
docker run -t --rm -v `pwd`/tests/screenshots/django21:/app/tests/screenshots/results djangocms-admin-style-test:django21
docker build -t djangocms-admin-style-test:django-$(VERSION) -f Dockerfile.django-$(VERSION) .
docker run -t --rm -v `pwd`/tests/screenshots/django-$(VERSION):/app/tests/screenshots/results djangocms-admin-style-test:django-$(VERSION)

# Django 2.2
run22:
make build
docker build -t djangocms-admin-style-test:django22 -f Dockerfile.django22 .
docker run -t --rm -p $(PORT):8000 -v `pwd`:/app djangocms-admin-style-test:django22 bash -c "pip install -r tests/requirements/django-2.2.txt && python tests/settings-docker.py"

test22:
make build
docker build -t djangocms-admin-style-test:django22 -f Dockerfile.django22 .
docker run -t --rm -v `pwd`/tests/screenshots/django22:/app/tests/screenshots/results djangocms-admin-style-test:django22
local:
@echo "> The reference files in "tests/screenshots" will differ locally from the Docker version (linux)."
@echo "> Make sure to run "npm install" using node 8 first."
@echo ""
make cleanup
pip install -r tests/requirements/django-$(VERSION).txt
pip install -e .
export SCREENSHOT_REFERENCES="./tests/screenshots/reference-$(VERSION)"; gulp lint && gulp tests:integration
25 changes: 17 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The following additional settings can be set:

The update checker does not gather or record any data.

To **compile CSS** run the following commands:
To **compile CSS** run the following commands using **node 8**:

* ``npm install``
* ``gulp``
Expand All @@ -80,13 +80,22 @@ For further options have a look at the ``gulpfile.js``.
Running Tests
-------------

In order to run **integration tests** you need to have Docker installed.

You can run tests by executing::

make test111
make test22
virtualenv env
source env/bin/activate
pip install -r tests/base.txt
python setup.py test

In order to run **integration tests** you need to have Docker installed,
then run the following command::

make test

To test other Django versions simply append `VERSION=3.1``. You can also
run the test server through::

make run

The integration tests are written using Casperjs, phantomcss and
djangocms-casper-helpers.
Expand All @@ -99,9 +108,9 @@ djangocms-casper-helpers.
.. |coverage| image:: https://codecov.io/gh/divio/djangocms-admin-style/branch/master/graph/badge.svg
:target: https://codecov.io/gh/divio/djangocms-admin-style

.. |python| image:: https://img.shields.io/badge/python-2.7%20%7C%203.4+-blue.svg
.. |python| image:: https://img.shields.io/badge/python-3.5+-blue.svg
:target: https://pypi.org/project/djangocms-admin-style/
.. |django| image:: https://img.shields.io/badge/django-1.11%20%7C%202.2%20%7C%203.0-blue.svg
.. |django| image:: https://img.shields.io/badge/django-2.2,%203.0,%203.1-blue.svg
:target: https://www.djangoproject.com/
.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.4%2B-blue.svg
.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.6%2B-blue.svg
:target: https://www.django-cms.org/
1 change: 0 additions & 1 deletion djangocms_admin_style/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
__version__ = '1.5.0'
1 change: 0 additions & 1 deletion djangocms_admin_style/models.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# -*- coding: utf-8 -*-
16 changes: 12 additions & 4 deletions djangocms_admin_style/sass/components/_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ ul.messagelist + #content {
h3 {
padding: 20px 25px;
background: $gray-lightest;
b, span {
b,
span {
font-size: $font-size-large;
}
span {
Expand Down Expand Up @@ -571,7 +572,7 @@ a.addlink {
background: $gray-lightest;
white-space: nowrap;
&:before {
content: '';
content: "";
position: absolute;
top: 0;
bottom: 0;
Expand Down Expand Up @@ -607,7 +608,7 @@ a.addlink {
@include button-variant($btn-default-color, $btn-default-bgcolor, $btn-default-border, true);
}
.revertlink {
@include button-variant($btn-default-color, $btn-default-bgcolor, $btn-default-border, true);;
@include button-variant($btn-default-color, $btn-default-bgcolor, $btn-default-border, true);
}
.historylink {
@include button-variant($btn-default-color, $btn-default-bgcolor, $btn-default-border, true);
Expand Down Expand Up @@ -740,7 +741,6 @@ a.addlink {
background: $color-primary !important;
}


// nani/hvad language buttons
.nani-language-tabs {
position: relative;
Expand Down Expand Up @@ -811,3 +811,11 @@ a.addlink {
.cke_maximized {
z-index: z(ckmaximized);
}

// attributes field
.attributes-pair .field-box {
margin-bottom: 10px;
}
.attributes-pair .field-box:first-child {
padding-right: 15px;
}
Loading

0 comments on commit c586847

Please sign in to comment.