Skip to content

Commit

Permalink
Drop support for Django < 1.11 and add support for Python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-k committed Jul 29, 2018
1 parent 785d255 commit e00f155
Show file tree
Hide file tree
Showing 43 changed files with 108 additions and 3,243 deletions.
78 changes: 52 additions & 26 deletions .travis.yml
@@ -1,34 +1,60 @@
dist: xenial
sudo: true
language: python
python:
- 3.5
- 3.6
- 3.7
# See tox.ini for env list
python: 3.5 # this is needed to fool travis to have python3.5 as well
env:
- TOXENV=checkmanifest
- TOXENV=flake8-check
- TOXENV=isort-check
- TOXENV=py27-django110-tests-usetztrue
- TOXENV=py27-django111-tests-usetzfalse
- TOXENV=py27-django111-tests-usetztrue
- TOXENV=py27-django16-tests-usetzfalse
- TOXENV=py27-django16-tests-usetztrue
- TOXENV=py27-django17-tests-usetztrue
- TOXENV=py27-django18-tests-usetztrue
- TOXENV=py27-django19-tests-usetztrue
- TOXENV=py34-django110-tests-usetztrue
- TOXENV=py34-django111-tests-usetztrue
- TOXENV=py34-django16-tests-usetzfalse
- TOXENV=py34-django16-tests-usetztrue
- TOXENV=py34-django17-tests-usetztrue
- TOXENV=py34-django18-tests-usetztrue
- TOXENV=py34-django19-tests-usetztrue
- TOXENV=py35-django110-tests-usetztrue
- TOXENV=py35-django111-tests-usetzfalse
- TOXENV=py35-django111-tests-usetztrue
- TOXENV=py35-django19-tests-usetztrue
- DJANGO=1.11 USETZ=True
- DJANGO=1.11 USETZ=False
- DJANGO=2.0 USETZ=True
- DJANGO=2.0 USETZ=False
- DJANGO=2.1 USETZ=True
- DJANGO=2.1 USETZ=False
- DJANGO=master USETZ=True
- DJANGO=master USETZ=False

matrix:
include:
- name: "Check manifest"
python: "3.7"
env: TOXENV=checkmanifest
- name: "flake8"
python: "3.7"
env: TOXENV=flake8-check
- name: "isort"
python: "3.7"
env: TOXENV=isort-check
- python: "2.7"
env: DJANGO=1.11 USETZ=True
dist: trusty
- python: "2.7"
env: DJANGO=1.11 USETZ=False
dist: trusty
- python: "3.4"
env: DJANGO=1.11 USETZ=True
dist: trusty
- python: "3.4"
env: DJANGO=1.11 USETZ=False
dist: trusty
- python: "3.4"
env: DJANGO=2.0 USETZ=True
dist: trusty
- python: "3.4"
env: DJANGO=2.0 USETZ=False
dist: trusty
exclude:
- python: "3.7"
env: DJANGO=1.11 USETZ=True
- python: "3.7"
env: DJANGO=1.11 USETZ=False

before_install:
- sudo apt-get -qq update
- sudo apt-get install -y libffi-dev python-dev libssl-dev
install:
- pip install tox>=2.1
- pip install tox>=2.1 tox-travis
script:
- tox
sudo: true
- tox
5 changes: 1 addition & 4 deletions CONTRIBUTING.rst
Expand Up @@ -45,13 +45,10 @@ New features need documentation adding in docs/

See docs/tests.rst for info about running the test suite.

If you make changes to the models, please create migrations for both Django 1.7+
and South e.g.::
If you make changes to the models, please create migrations for Django 1.11+ e.g.::

./manage.py makemigrations ipn

./manage.py schemamigration --auto ipn

If a pull request doesn't meet these requirements, and is not updated for 6
months after feedback is given to the author, it will be assumed they have lost
interest and the PR will be closed.
Expand Down
6 changes: 2 additions & 4 deletions README.rst
Expand Up @@ -16,13 +16,11 @@ See https://django-paypal.readthedocs.org/ for documentation.

django-paypal supports:

* Django 1.6 to 2.0
* Python 2.7, 3.3, 3.4 and 3.5
* Django 1.11+
* Python 2.7, and 3.4+

(Not all combinations are supported).

Please read the docs if you are upgrading from Django 1.7

Project status
==============

Expand Down
6 changes: 2 additions & 4 deletions docs/install.rst
Expand Up @@ -10,10 +10,8 @@ Or using the latest version from GitHub::

pip install git://github.com/spookylukey/django-paypal.git#egg=django-paypal

If you are using Django < 1.7, you should also install South >= 1.0.1 if you
haven't already. This is not listed as a dependency for the sake of users who
are on Django >= 1.7 and don't need it.

If you are using Django < 1.11, you should use django-paypal 0.5.x and refer to
its documentation.

You will also need to edit your ``settings.py``, but the specifics depend on
whether you are using IPN/PDT/Pro.
Expand Down
4 changes: 2 additions & 2 deletions docs/standard/ipn.rst
Expand Up @@ -169,9 +169,9 @@ Using PayPal Standard IPN
Remember to ensure that import the hooks file is imported i.e. that you are
connecting the signals when your project initializes. The standard way to do
this is to `create an AppConfig class
<https://docs.djangoproject.com/en/1.11/ref/applications/#configuring-applications>`_
<https://docs.djangoproject.com/en/2.1/ref/applications/#configuring-applications>`_
and add a `ready()
<https://docs.djangoproject.com/en/1.11/ref/applications/#django.apps.AppConfig.ready>`_
<https://docs.djangoproject.com/en/2.1/ref/applications/#django.apps.AppConfig.ready>`_
method, in which you can register your signal handlers or import a module
that does this.

Expand Down
69 changes: 1 addition & 68 deletions docs/updatedb.rst
@@ -1,75 +1,8 @@
Update the database
===================

django-paypal uses South for migrations for Django < 1.7, and the built in
Django migrations framework for Django >= 1.7.
django-paypal uses the built in Django migrations framework.

To update your database:

* For Django < 1.7:

* Ensure South is installed if it isn't already:

* Do::

pip install 'South>=1.0.1'

* Add 'south' to your `INSTALLED_APPS` setting.

* Run the following to install South tables::

./manage.py syncdb

* Then for each time you install or upgrade django-paypal, run::

./manage.py migrate


* For Django >= 1.7::

./manage.py migrate


Upgrading from very old versions
--------------------------------

If you using Django < 1.7 and are upgrading from a very old version (before
0.1.1) that wasn't using South, you will have to use ``--fake`` - see
http://south.readthedocs.org/en/latest/commands.html?highlight=fake

It will probably look something like::

./manage.py migrate ipn --fake --initial
./manage.py migrate pdt --fake --initial
./manage.py migrate pro --fake --initial
./manage.py migrate ipn
./manage.py migrate pdt
./manage.py migrate pro

depending on what apps you have installed.

Please also see :doc:`release_notes`.

Upgrading to Django 1.7
-----------------------

If you installed django-paypal with an older version of Django, you will have
been using South to handle database migrations. Due to the new built-in database
migration framework in Django 1.7, the upgrade procedure is slightly
complicated.

The recommended upgrade procedure is:

* Before upgrading to Django 1.7, first upgrade django-paypal to the latest
version and run migrations as above (including deploying to your production
environment and running migrations there).

* Then upgrade Django to 1.7, and run the following as appropriate for your
situation::

./manage.py migrate ipn --fake
./manage.py migrate pdt --fake
./manage.py migrate pro --fake

In this way, you can avoid running equivalent migrations twice (the South versions
and the Django built-in versions).
5 changes: 2 additions & 3 deletions manage.py
Expand Up @@ -3,12 +3,11 @@
# This manage.py exists for the purpose of creating migrations
import sys

import django
from django.conf import settings
from django.core.management import execute_from_command_line

settings.configure(
ROOT_URLCONF='paypal.standard.ipn.tests.test_urls', # So Django 1.9 doesn't die
ROOT_URLCONF='paypal.standard.ipn.tests.test_urls',
DATABASES={'default':
{'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test.db',
Expand All @@ -21,7 +20,7 @@
'paypal.standard',
'paypal.standard.ipn',
'paypal.standard.pdt',
] + (['south'] if django.VERSION < (1, 7) else []),
],
CACHES={
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
Expand Down
5 changes: 1 addition & 4 deletions paypal/pro/models.py
Expand Up @@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django
from django.conf import settings
from django.db import models
from django.forms.models import model_to_dict
Expand Down Expand Up @@ -102,9 +101,7 @@ def init(self, request, paypal_request, paypal_response):
if request is not None:
from paypal.pro.helpers import strip_ip_port
self.ipaddress = strip_ip_port(request.META.get('REMOTE_ADDR', ''))
if (hasattr(request, "user") and
(request.user.is_authenticated if django.VERSION >= (1, 10)
else request.user.is_authenticated())):
if (hasattr(request, "user") and request.user.is_authenticated):
self.user = request.user
else:
self.ipaddress = ''
Expand Down
100 changes: 0 additions & 100 deletions paypal/pro/south_migrations/0001_initial.py

This file was deleted.

0 comments on commit e00f155

Please sign in to comment.