Skip to content

Commit

Permalink
Merge pull request #2 from HousekeepLtd/feature/django-4-compatibilit…
Browse files Browse the repository at this point in the history
…y-187356151

Add Django 4 compatibility
  • Loading branch information
horthbynorthwest authored May 17, 2024
2 parents ef8c909 + 6e13e2c commit f533cea
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 257 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]
django_version: [~=2.2.0, ~=3.2.0]
python-version: [3.8, 3.9, '3.10', 3.11]
django_version: [~=3.2.0, ~=4.2.0]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
30 changes: 6 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,16 @@ os: linux
language: python
jobs:
include:
- python: "2.7"
env: DJANGO=1.11.* DJANGO_SETTINGS_MODULE='settings_sqllite'
- python: "2.7"
env: DJANGO=1.11.* DJANGO_SETTINGS_MODULE='settings_postgres'
- python: "3.8"
env: DJANGO=3.2.* DJANGO_SETTINGS_MODULE='settings_sqllite'
- python: "3.8"
env: DJANGO=3.2.* DJANGO_SETTINGS_MODULE='settings_postgres'
services:
- postgresql
before_script:
- psql -c 'create database travis_test;' -U postgres
- python: "2.7"
env: DJANGO=1.11.* DJANGO_SETTINGS_MODULE='settings_mysql'
services:
- mysql
before_script:
- mysql -e 'create database travis_test;'
- python: "3.7"
env: DJANGO=1.11.* DJANGO_SETTINGS_MODULE='settings_sqllite'
- python: "3.7"
env: DJANGO=2.0.* DJANGO_SETTINGS_MODULE='settings_sqllite'
- python: "3.7"
env: DJANGO=3.0.* DJANGO_SETTINGS_MODULE='settings_sqllite'
- python: "3.7"
env: DJANGO=3.0.* DJANGO_SETTINGS_MODULE='settings_postgres'
services:
- postgresql
before_script:
- psql -c 'create database travis_test;' -U postgres
- python: "3.7"
env: DJANGO=3.0.* DJANGO_SETTINGS_MODULE='settings_mysql'
- python: "3.8"
env: DJANGO=3.2.* DJANGO_SETTINGS_MODULE='settings_mysql'
services:
- mysql
before_script:
Expand Down
Empty file removed demo/demo/__init__.py
Empty file.
42 changes: 0 additions & 42 deletions demo/demo/cron.py

This file was deleted.

130 changes: 0 additions & 130 deletions demo/demo/settings.py

This file was deleted.

22 changes: 0 additions & 22 deletions demo/demo/urls.py

This file was deleted.

16 changes: 0 additions & 16 deletions demo/demo/wsgi.py

This file was deleted.

10 changes: 0 additions & 10 deletions demo/manage.py

This file was deleted.

2 changes: 0 additions & 2 deletions demo/requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions django_cron/backends/lock/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

class DatabaseLock(DjangoCronJobLock):
"""
Locking cron jobs with database. Its good when you have not parallel run and want to make sure 2 jobs won't be
Locking cron jobs with database. It's good when you have not parallel run and want to make sure 2 jobs won't be
fired at the same time - which may happened when job execution is longer that job interval.
"""

@transaction.atomic
def lock(self):
lock, created = CronJobLock.objects.get_or_create(job_name=self.job_name)
lock, created = CronJobLock.objects.select_for_update().get_or_create(job_name=self.job_name)
if lock.locked:
return False
else:
Expand Down
4 changes: 2 additions & 2 deletions django_cron/cron.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.conf import settings

from django_common.helper import send_mail
from django.core.mail import send_mail

from django_cron import CronJobBase, Schedule, get_class
from django_cron.models import CronJobLog
Expand Down Expand Up @@ -97,5 +97,5 @@ def get_send_mail_kwargs(self, cron_cls, failed_jobs):
return dict(
subject=subject, message=message,
from_email=self.config['CRON_FAILURE_FROM_EMAIL'],
recipient_emails=self.config['CRON_FAILURE_EMAIL_RECIPIENTS']
recipient_list=self.config['CRON_FAILURE_EMAIL_RECIPIENTS']
)
2 changes: 1 addition & 1 deletion django_cron/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,5 +480,5 @@ def test_uses_send_mail(self, mock_send_mail):
self.assertIn('ERROR!!!', kwargs['subject'])
self.assertEquals('[email protected]', kwargs['from_email'])
self.assertEquals(
['[email protected]', '[email protected]'], kwargs['recipient_emails']
['[email protected]', '[email protected]'], kwargs['recipient_list']
)
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
# built documents.
#
# The short X.Y version.
version = '0.6'
version = '0.7'
# The full version, including alpha/beta/rc tags.
release = '0.6.1a1'
release = '0.7.1a1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

setup(
name='django-cron',
version='0.6.1a1',
version='0.7.1a1',
author='Sumit Chachra',
author_email='[email protected]',
url='http://github.com/tivix/django-cron',
Expand All @@ -29,7 +29,7 @@
long_description=long_description,
keywords='django cron',
zip_safe=False,
install_requires=['Django>=2.2,<4', 'django-common-helpers>=0.6.4'],
install_requires=['Django>=3.2,<5', 'django-common-helpers>=0.6.4'],
test_suite='runtests.runtests',
include_package_data=True,
classifiers=[
Expand Down

0 comments on commit f533cea

Please sign in to comment.