Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 5 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.10", "3.12", "3.13"]
django-version:
- "Django>=2.2,<2.3"
- "Django>=3.0,<3.1"
- "Django>=3.1,<3.2"
- "Django>=3.2,<3.3"
- "Django>=4.2,<4.3"
- "Django>=5.2,<5.3"
exclude:
# Django 3.1+ supports Python 3.9.
# https://docs.djangoproject.com/en/3.1/releases/3.1.3/
- python-version: "3.9"
django-version: "Django>=2.2,<2.3"
- python-version: "3.9"
django-version: "Django>=3.0,<3.1"
# Django 3.2+ supports Python 3.10.
# https://docs.djangoproject.com/en/3.2/releases/3.2/
- python-version: "3.10"
django-version: "Django>=2.2,<2.3"
- python-version: "3.10"
django-version: "Django>=3.0,<3.1"
- python-version: "3.10"
django-version: "Django>=3.1,<3.2"
# Django 4.2 supports Python 3.8–3.12.
- python-version: "3.13"
django-version: "Django>=4.2,<4.3"
steps:
- uses: actions/checkout@v4
- name: Setup python
Expand All @@ -43,14 +29,6 @@ jobs:
PYTHONWARNINGS: error
DJANGO_SETTINGS_MODULE: cove.settings
SECRET_KEY: 7ur)dt+e%1^e6$8_sd-@1h67_5zixe2&39%r2$$8_7v6fr_7ee
if: ${{ matrix.django-version != 'Django>=4.2,<4.3' }}
# Don't set PYTHONWARNING for Django 4.2, as that has some known
# deprecation warnings for 5.0
- run: "py.test -n 2 cove --cov"
env:
DJANGO_SETTINGS_MODULE: cove.settings
SECRET_KEY: 7ur)dt+e%1^e6$8_sd-@1h67_5zixe2&39%r2$$8_7v6fr_7ee
if: ${{ matrix.django-version == 'Django>=4.2,<4.3' }}
- name: Check existing migrations can run and no migrations are missing
env:
DJANGO_SETTINGS_MODULE: cove.settings
Expand Down
15 changes: 14 additions & 1 deletion cove/input/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from werkzeug.http import parse_options_header
import secrets
import string
import django

CONTENT_TYPE_MAP = {
'application/json': 'json',
Expand All @@ -26,9 +27,21 @@ def upload_to(instance, filename=''):
return os.path.join(str(instance.pk), random_string, filename)


# This class is only needed while Django<5 is supported.
class URLField(models.URLField):
def formfield(self, **kwargs):
if django.VERSION >= (5, 0):
kwargs.setdefault('assume_scheme', 'https')
return super().formfield(**kwargs)

def deconstruct(self):
name, path, args, kwargs = super().deconstruct()
return name, "django.db.models.URLField", args, kwargs


class SuppliedData(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
source_url = models.URLField(null=True, max_length=2000)
source_url = URLField(null=True, max_length=2000)
original_file = models.FileField(upload_to=upload_to, max_length=256)
current_app = models.CharField(max_length=20)

Expand Down
2 changes: 1 addition & 1 deletion cove/management/commands/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_expire_files():
recent.original_file.save('test.json', ContentFile('{}'))

old = SuppliedData.objects.create()
old.created = timezone.datetime(2015, 1, 1, tzinfo=timezone.utc)
old.created = timezone.datetime(2015, 1, 1, tzinfo=datetime.timezone.utc)
old.original_file.save('test.json', ContentFile('{}'))

call_command('expire_files')
Expand Down
2 changes: 0 additions & 2 deletions cove/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
classifiers=["License :: OSI Approved :: BSD License"],
python_requires=">=3.8",
install_requires=[
"Django>=2.2,<4.3",
"Django>=4.2,<5.3",
"django-bootstrap3",
"requests",
"flattentool",
Expand Down
Loading