Skip to content

Commit

Permalink
Merge pull request #350 from jdufresne/dj20
Browse files Browse the repository at this point in the history
Add support for upcoming Django 2.0; drop support for Django < 1.11
  • Loading branch information
kimarakov committed Dec 10, 2017
2 parents c3bc4a6 + e3b6de9 commit 6ad2129
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 62 deletions.
28 changes: 7 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,6 @@ cache: pip

matrix:
include:
- python: 2.7
env: DJANGO="Django>=1.8,<1.9"
- python: 3.3
env: DJANGO="Django>=1.8,<1.9"
- python: 3.4
env: DJANGO="Django>=1.8,<1.9"
- python: 3.5
env: DJANGO="Django>=1.8,<1.9"
- python: 2.7
env: DJANGO="Django>=1.9,<1.10"
- python: 3.4
env: DJANGO="Django>=1.9,<1.10"
- python: 3.5
env: DJANGO="Django>=1.9,<1.10"
- python: 2.7
env: DJANGO="Django>=1.10,<1.11"
- python: 3.4
env: DJANGO="Django>=1.10,<1.11"
- python: 3.5
env: DJANGO="Django>=1.10,<1.11"
- python: 2.7
env: DJANGO="Django>=1.11,<2.0"
- python: 3.4
Expand All @@ -32,6 +12,12 @@ matrix:
env: DJANGO="Django>=1.11,<2.0"
- python: 3.6
env: DJANGO="Django>=1.11,<2.0"
- python: 3.4
env: DJANGO="Django>=2.0,<2.1"
- python: 3.5
env: DJANGO="Django>=2.0,<2.1"
- python: 3.6
env: DJANGO="Django>=2.0,<2.1"

install:
- pip install $DJANGO
Expand All @@ -40,7 +26,7 @@ before_script:
- flake8
- isort --check-only --diff
script:
- coverage run runtests.py
- coverage run -m django test --settings=tests.settings
- coverage report -m
after_success:
- coveralls --verbose
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ This setting controls the callable used to determine if a user has permission to
Default:
```python
check_edit_permission(ob, user):
return user.is_authenticated()
return user.is_authenticated
```

If ob is None, then the function is checking for permission to add new events
Expand All @@ -163,7 +163,7 @@ This setting controls the callable used to determine if a user has permission to
Default:
```python
check_edit_permission(ob, user):
return user.is_authenticated()
return user.is_authenticated
```

### GET_EVENTS_FUNC
Expand Down
4 changes: 2 additions & 2 deletions docs/settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This setting controls the callable used to determine if a user has permission to
example::

check_edit_permission(ob, user):
return user.is_authenticated()
return user.is_authenticated

If ob is None, then the function is checking for permission to add new events.

Expand All @@ -43,7 +43,7 @@ This setting controls the callable used to determine if a user has permission to
example::

check_edit_permission(ob, user):
return user.is_authenticated()
return user.is_authenticated


.. _ref-settings-get-events-func:
Expand Down
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
-e .
coverage>=3.7.1
coveralls>=0.5
django-annoying>=0.8.0
Django>=1.11
flake8
icalendar>=3.8.4
isort
mock
python-dateutil>=2.1
pytz>=2013.9
wheel
20 changes: 0 additions & 20 deletions runtests.py

This file was deleted.

2 changes: 1 addition & 1 deletion schedule/models/calendars.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

from django.contrib.contenttypes import fields
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models import Q
from django.db.models.base import ModelBase
from django.template.defaultfilters import slugify
from django.urls import reverse
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.six import with_metaclass
Expand Down
2 changes: 1 addition & 1 deletion schedule/models/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from django.conf import settings as django_settings
from django.contrib.contenttypes import fields
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models import Q
from django.db.models.base import ModelBase
from django.template.defaultfilters import date
from django.urls import reverse
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.six import with_metaclass
Expand Down
4 changes: 2 additions & 2 deletions schedule/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

if not CHECK_EVENT_PERM_FUNC:
def check_event_permission(ob, user):
return user.is_authenticated()
return user.is_authenticated

CHECK_EVENT_PERM_FUNC = check_event_permission

Expand All @@ -31,7 +31,7 @@ def check_occurrence_permission(ob, user):

if not CHECK_CALENDAR_PERM_FUNC:
def check_calendar_permission(ob, user):
return user.is_authenticated()
return user.is_authenticated

CHECK_CALENDAR_PERM_FUNC = check_calendar_permission

Expand Down
4 changes: 2 additions & 2 deletions schedule/templatetags/scheduletags.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from django import template
from django.conf import settings
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.utils import timezone
from django.utils.dateformat import format
from django.utils.html import escape
Expand Down Expand Up @@ -62,7 +62,7 @@ def daily_table(context, day, start=8, end=20, increment=30):
user = context['request'].user
addable = CHECK_EVENT_PERM_FUNC(None, user)
if 'calendar' in context:
addable &= CHECK_CALENDAR_PERM_FUNC(context['calendar'], user)
addable = addable and CHECK_CALENDAR_PERM_FUNC(context['calendar'], user)
context['addable'] = addable
day_part = day.get_time_slot(day.start + datetime.timedelta(hours=start), day.start + datetime.timedelta(hours=end))
# get slots to display on the left
Expand Down
2 changes: 1 addition & 1 deletion schedule/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import dateutil.parser
import pytz
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db.models import F, Q
from django.http import (
Http404, HttpResponseBadRequest, HttpResponseRedirect, JsonResponse,
)
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils import timezone
from django.utils.http import is_safe_url
from django.utils.six.moves.urllib.parse import quote
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,16 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Framework :: Django',
'Framework :: Django :: 1.8',
'Framework :: Django :: 1.9',
'Framework :: Django :: 1.10',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
'Topic :: Utilities',
],
install_requires=[
'Django>=1.8',
'Django>=1.11',
'python-dateutil>=2.1',
'pytz>=2013.9',
'icalendar>=3.8.4',
Expand Down
2 changes: 1 addition & 1 deletion tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
]

MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import pytz
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from django.utils import timezone

from schedule.models import Calendar, Event, EventRelation, Rule
Expand Down
2 changes: 1 addition & 1 deletion tests/test_perms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone

from schedule import utils
Expand Down
2 changes: 1 addition & 1 deletion tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import json

import pytz
from django.core.urlresolvers import reverse
from django.http import Http404
from django.test import TestCase, override_settings
from django.urls import reverse
from django.utils import timezone

from schedule.models.calendars import Calendar
Expand Down

0 comments on commit 6ad2129

Please sign in to comment.