Skip to content

Commit b62a7bd

Browse files
authored
Merge pull request #29 from jmichalicek/django-4.1
Django 4.1
2 parents 7b44b61 + 398f495 commit b62a7bd

10 files changed

Lines changed: 32 additions & 28 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,7 @@ docs/_build
4949
*~
5050
\#*#
5151
*.swp
52+
53+
# vs code
54+
.devcontainer
55+
.vscode

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.8.5-buster AS dev
1+
FROM python:3.10.5-bullseye AS dev
22
LABEL maintainer="Justin Michalicek <jmichalicek@gmail.com>"
33
ENV PYTHONUNBUFFERED 1
44

@@ -11,7 +11,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteract
1111
postgresql-client \
1212
&& apt-get autoremove && apt-get clean
1313

14-
RUN pip install pip==20.2.2
14+
RUN pip install pip -U
1515
RUN useradd -ms /bin/bash -d /django django && echo "django ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
1616
USER django
1717
ENV HOME=/django PATH=/django/bash-shell.net/.venv/bin:/django/.local/bin:$PATH LC_ALL=C.UTF-8 LANG=C.UTF-8 PYTHONIOENCODING=utf-8

djfractions/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '2.0.0'
1+
__version__ = '4.0.0'
22

33
import fractions
44
import re

djfractions/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class FractionsAppConfig(AppConfig):
5+
name = 'djfractions'

djfractions/models/fields.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import decimal
22
import fractions
33
import logging
4-
from typing import Any, List, Tuple, Union
4+
from typing import Any, List, Optional, Tuple, Union
55

66
from django.core import checks
77
from django.core.checks.messages import CheckMessage
@@ -190,19 +190,13 @@ def deconstruct(self) -> Tuple[str, str, list, dict]:
190190

191191
return name, path, args, kwargs
192192

193-
def formfield(self, **kwargs) -> Any:
194-
defaults = {
195-
'form_class': fraction_forms.FractionField,
196-
}
197-
defaults.update(kwargs)
198-
199-
# return super().formfield(**{
200-
# 'max_digits': self.max_digits,
201-
# 'decimal_places': self.decimal_places,
202-
# 'form_class': forms.DecimalField,
203-
# **kwargs,
204-
# })
205-
return super().formfield(**defaults)
193+
def formfield(
194+
self,
195+
form_class: Optional[Any] = fraction_forms.FractionField,
196+
choices_form_class: Optional[Any] = None,
197+
**kwargs: Any
198+
) -> Any:
199+
return super().formfield(form_class=form_class, choices_form_class=choices_form_class, **kwargs)
206200

207201
def get_internal_type(self) -> str:
208202
# returning DecimalField, since we use the same backing column type as that

runtests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
'context_processors': []
4040
}
4141
}
42-
]
42+
],
43+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
4344

4445
)
4546

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.0.0
2+
current_version = 3.0.0
33
commit = True
44
tag = True
55

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@
4242
zip_safe=False,
4343
keywords='django-fractions',
4444
classifiers=[
45-
'Development Status :: 2 - Pre-Alpha',
45+
'Development Status :: 4 - Beta',
4646
'Framework :: Django',
47+
'Framework :: Django :: 3.2',
48+
'Framework :: Django :: 4.0',
49+
'Framework :: Django :: 4.1',
4750
'Intended Audience :: Developers',
4851
'License :: OSI Approved :: BSD License',
4952
'Natural Language :: English',

test_project/frac/frac/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
'django.contrib.sessions',
3838
'django.contrib.messages',
3939
'django.contrib.staticfiles',
40-
'app.apps.AppConfig',
40+
'app',
4141
]
4242

4343
MIDDLEWARE = [
@@ -106,3 +106,4 @@
106106
# https://docs.djangoproject.com/en/2.2/howto/static-files/
107107

108108
STATIC_URL = '/static/'
109+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

tox.ini

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
[tox]
22
envlist =
3-
{py37,py38,py39}-django-22
4-
{py37,py38,py39}-django-3
5-
{py37,py38,py39}-django-31
63
{py37,py38,py39,py310}-django-32
74
{py38,py39,py310}-django-40
5+
{py38,py39,py310}-django-41
86
coverage
97

108
[gh-actions]
@@ -21,18 +19,16 @@ commands =
2119
coverage run --source djfractions runtests.py
2220
mypy djfractions
2321
deps =
24-
django-22: Django>=2.2,<3
25-
django-3: Django>=3,<3.1
26-
django-31: Django>=3.1,<3.2
2722
django-32: Django>=3.2,<3.3
2823
django-40: Django>=4.0,<4.1
24+
django-41: Django>=4.1,<4.2
2925
-r{toxinidir}/requirements-test.txt
3026
basepython =
3127
py37: python3.7
3228
py38: python3.8
3329
py39: python3.9
3430
py310: python3.10
35-
coverage: python3.7
31+
coverage: python3.10
3632

3733
[testenv:coverage]
3834
commands=

0 commit comments

Comments
 (0)