Skip to content

Commit

Permalink
Merge pull request #8 from thorgate/feature/django-21-support
Browse files Browse the repository at this point in the history
Update supported versions
  • Loading branch information
jorgenader authored Feb 7, 2019
2 parents 592089b + 59a7741 commit 94a2deb
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 10 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
language: python
dist: xenial

python:
- "3.4"
- "3.5"
- "3.6"
- "3.7"

env:
- DJANGO=1.8
- DJANGO=1.11
- DJANGO=2.0
- DJANGO=2.1

matrix:
exclude:
- python: "3.4"
env: DJANGO=2.1
- python: "3.7"
env: DJANGO=1.8
- python: "3.7"
env: DJANGO=1.11

install:
- pip install tox tox-travis
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Contributors
------------

* Taavi Teska <[email protected]>
* Jorgen Ader <[email protected]>
15 changes: 15 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
History
=======

0.4.0 (2019-02-07)
------------------

* Supported Django and Python versions are listed below

=============== ==================
Django version Python versions
--------------- ------------------
Django 1.8 3.4, 3.5, 3.6
Django 1.11 3.4, 3.5, 3.6
Django 2.0 3.4, 3.5, 3.6, 3.7
Django 2.1 3.5, 3.6, 3.7
=============== ==================


0.3.0 (2018-03-12)
------------------

Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
with open('HISTORY.rst') as history_file:
history = history_file.read()

requirements = [
'django>=1.8,<2.1',
]

setup(
name='tg-utils',
Expand All @@ -34,7 +31,9 @@
package_dir={'tg_utils':
'tg_utils'},
include_package_data=True,
install_requires=requirements,
install_requires=[
'django>=1.8,!=2.1.0,!=2.1.1,<2.2',
],
license="ISCL",
zip_safe=False,
keywords='tg-utils tg_utils',
Expand All @@ -47,5 +46,6 @@
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)
2 changes: 1 addition & 1 deletion tg_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = 'Thorgate'
__email__ = '[email protected]'
__version__ = '0.3.0'
__version__ = '0.4.0'
19 changes: 15 additions & 4 deletions tg_utils/admin.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
import django

from django.contrib.admin.options import InlineModelAdmin
from django.forms.models import BaseInlineFormSet


# Select correct has_add_permission signature based on Django version
if django.VERSION >= (2, 1):
class ReadOnlyAddAdminMixin:
def has_add_permission(self, request, obj):
return False

else:
class ReadOnlyAddAdminMixin:
def has_add_permission(self, request):
return False


class AutoMediaFormSet(BaseInlineFormSet):
@property
def media(self):
return self.empty_form.media


class StaticModelAdmin(InlineModelAdmin):
class StaticModelAdmin(ReadOnlyAddAdminMixin, InlineModelAdmin):
""" Displays inline models as read-only.
"""

Expand All @@ -18,9 +32,6 @@ class StaticModelAdmin(InlineModelAdmin):

exclude = ('created_by', 'created_at', 'closed_by', 'closed_at', 'updated_at', )

def has_add_permission(self, request):
return False

def has_delete_permission(self, request, obj=None):
return False

Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[tox]
envlist = py{34,35,36}-django{18,111,20}
envlist = py{34,35,36}-django{18,111,20},py{35,36,37}-django{20,21}

[travis:env]
DJANGO =
1.8: django18
1.11: django111
2.0: django20
2.1: django21

[testenv]
setenv =
Expand All @@ -16,6 +17,7 @@ deps =
django18: Django>=1.8,<1.9
django111: Django>=1.11,<1.12
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
-r{toxinidir}/requirements_test.txt

[testenv:py36-django20]
Expand Down

0 comments on commit 94a2deb

Please sign in to comment.