Skip to content

Commit 7b3a931

Browse files
authored
Merge pull request #82 from Aristotle-Metadata-Enterprises/2026-bump
New version to support django 6.0, drops support for unsupported django
2 parents 70f00f3 + 7eb026f commit 7b3a931

File tree

12 files changed

+90
-49
lines changed

12 files changed

+90
-49
lines changed

.github/workflows/black.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,4 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v2
10-
- uses: actions/setup-python@v2
11-
with:
12-
python-version: 3.9
1310
- uses: psf/black@stable

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ jobs:
2626
--health-retries 5
2727
mariadb:
2828
# Docker Hub image
29-
image: mariadb:10
29+
image: mariadb:12
3030
env:
3131
MYSQL_DATABASE: test
3232
MYSQL_ALLOW_EMPTY_PASSWORD: yes
3333
ports:
3434
- 13306:3306
3535
# Set health checks to wait until mariadb has started
3636
options: >-
37-
--health-cmd="mysqladmin ping"
37+
--health-cmd="healthcheck.sh --connect --innodb_initialized"
3838
--health-interval 10s
3939
--health-timeout 5s
4040
--health-retries 10

CONTRIBUTING.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Want to help maintain this library?
2+
3+
There is a `/dev/` directory with a docker-compose stack you can use to bring up a database and clean development environment.
4+
5+
## Running tests
6+
7+
Django Garnett is tested using a docker-compose environment so tests can be easily run locally against MariaDB, Postgres and SQLite.
8+
9+
To run tests:
10+
* ``cd ./dev``
11+
* Start the docker environment - ``docker-compose up``
12+
* Start a development shell - ``docker-compose exec dev bash``
13+
* Run tests - ``tox``
14+
15+
## Code formating
16+
17+
This library uses [python-black][python-black] for formating, you can format your code so it passes linting by:
18+
* ``cd ./dev``
19+
* Start the docker environment - ``docker-compose up``
20+
* Start a development shell - ``docker-compose exec dev bash``
21+
* Run tests - ``black .``
22+
23+
Then review and recommit your code and its ready to go.
24+
25+
[python-black]: https://github.com/psf/black

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ TranslatedFields will list the history and changes in json, but it does do compa
357357
* Searching for "Famous Translators" will tell you about [Constance Garnett](https://en.wikipedia.org/wiki/Constance_Garnett).
358358
* Searching for "Django Garnett" showed there was no python library with this name.
359359
* It did however talk about [Garnet Clark](https://en.wikipedia.org/wiki/Garnet_Clark) (also spelled Garnett), a jazz pianist who played with Django Reinhart - the namesake of the Django Web Framework.
360-
* Voila - a nice name
360+
* Voilà - a nice name
361361

362362
## Warnings
363363

@@ -367,10 +367,6 @@ TranslatedFields will list the history and changes in json, but it does do compa
367367
`AdminTextAreaWidget` on translated fields in the django admin site by default. They can however
368368
be specified explicitly on the corresponding admin model form.
369369

370-
## Want to help maintain this library?
371-
372-
There is a `/dev/` directory with a docker-compose stack you can ues to bring up a database and clean development environment.
373-
374370
## Want other options?
375371

376372
There are a few good options for adding translatable strings to Django that may meet other use cases. We've included a few other options here, their strengths and why we didn't go with them.
@@ -391,8 +387,6 @@ There are a few good options for adding translatable strings to Django that may
391387

392388
**Cons:** Languages are stored in a separate table and can't be altered by users later. Translated fields are specified in model meta, away from the fields definition which makes complex lookups harder.
393389

394-
395-
396390
[term-language-code]: https://docs.djangoproject.com/en/3.1/topics/i18n/#term-language-code
397391
[django-how]: https://docs.djangoproject.com/en/3.1/topics/i18n/translation/#how-django-discovers-language-preference
398392
[dunder-html]: https://code.djangoproject.com/ticket/7261

dev/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: '3'
44

55
services:
66
maria_db:
7-
image: mariadb:10
7+
image: mariadb:12
88
environment:
99
- MYSQL_ROOT_PASSWORD=changeme
1010
postgres_db:

dev/local-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fi
2323
if [ $RUN_MARIA -eq 1 ]
2424
then
2525
echo "Testing with MariaDB"
26-
DATABASE_URL=mysql://root:@maria_db:13306/test tox -e ${TOX_ENV}
26+
DATABASE_URL=mysql://root:changeme@maria_db:3306/test tox -e ${TOX_ENV}
2727
fi
2828

2929
if [ $RUN_PG -eq 1 ]

garnett/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def validator(values: dict):
5151

5252

5353
def translatable_default(
54-
inner_default: Union[str, Callable[[], str]]
54+
inner_default: Union[str, Callable[[], str]],
5555
) -> Dict[str, str]:
5656
"""Return default from inner field as dict with current language"""
5757
lang = get_current_language_code()

poetry.lock

Lines changed: 46 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-garnett"
3-
version = "0.5.3"
3+
version = "0.5.4"
44
description = "Simple translatable Django fields"
55
authors = ["Aristotle Metadata Enterprises"]
66
license = "BSD-3-Clause"
@@ -11,7 +11,7 @@ packages = [
1111

1212
[tool.poetry.dependencies]
1313
python = "^3.12"
14-
django = ">=4.1"
14+
django = ">=4.2"
1515
langcodes = "~3.3.0"
1616
language-data = "~1.0.1"
1717

tests/library_app/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
ALLOWED_HOSTS = ["localhost", "127.0.0.1", "django-garnett.herokuapp.com"]
3232

33+
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
34+
3335
SERIALIZATION_MODULES = {"json": "garnett.serializers.json"}
3436

3537
# Application definition

0 commit comments

Comments
 (0)