Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dj4.2 #38

Merged
merged 1 commit into from
Feb 27, 2024
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ jobs:
strategy:
fail-fast: false
matrix:
django-version: [ "3.2", ]
django-version: [ "4.2", ]
python-version: [ "3.11", ]
experimental: [ false ]
# include:
# - django-version: "4.2"
# - django-version: "5.0"
# python-version: "3.11"
# experimental: true
continue-on-error: ${{ matrix.experimental }}
Expand Down
844 changes: 458 additions & 386 deletions pdm.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies = [
"Pillow",
"celery",
"cryptography",
"django<4,>=3",
"django<5",
"django-admin-extra-buttons",
"django-admin-ordering",
"django-admin-sync",
Expand Down
16 changes: 6 additions & 10 deletions src/aurora/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@

ROOT_URLCONF = "aurora.config.urls"

# TEMPLATE_LOADERS = (
# "dbtemplates.loader.Loader",
# "django.template.loaders.filesystem.Loader",
# "django.template.loaders.app_directories.Loader",
# )
TEMPLATE_LOADERS = (
"dbtemplates.loader.Loader",
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
)

TEMPLATES = [
{
Expand All @@ -138,11 +138,7 @@
],
"APP_DIRS": False,
"OPTIONS": {
"loaders": [
"dbtemplates.loader.Loader",
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
],
"loaders": TEMPLATE_LOADERS,
# 'builtins': [
# 'http2.templatetags',
# ],
Expand Down
2 changes: 1 addition & 1 deletion src/aurora/core/templates/django/forms/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% for field, errors in fields %}
<tr{% with classes=field.css_classes %}{% if classes %} class="{{ classes }}"{% endif %}{% endwith %}><th>{% if field.label %}{{ field.label_tag }}{% endif %}</th>
<td>
{% include "registration/_fieldset.html" %}
{% include "smart/_fieldset.html" %}
</td>
</tr>
{% endfor %}
Expand Down
8 changes: 4 additions & 4 deletions src/aurora/i18n/templatetags/itrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def render(self, context):
value = translator[current_locale][msgid]

if self.asvar:
context[self.asvar] = value
context[self.asvar] = str(value)
context[f"{self.asvar}_msgid"] = msgid
return ""
else:
return value
return str(value)


class BlockTranslateNode(Node):
Expand Down Expand Up @@ -136,10 +136,10 @@ def render_value(key):
with translation.override(None):
result = self.render(context, nested=True)
if self.asvar:
context[self.asvar] = result
context[self.asvar] = str(result)
return ""
else:
return result
return str(result)


@register.tag("translate")
Expand Down
8 changes: 4 additions & 4 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ def test_changeform(app, modeladmin, record):
res = app.get(url)
assert str(opts.app_config.verbose_name) in res.body.decode()
if modeladmin.has_change_permission(Mock(user=app._user)):
res = res.form.submit()
res = res.forms[1].submit()
assert res.status_code in [302, 200]
# else:
# res.form.submit(expect_errors=True)
# res.forms[1].submit(expect_errors=True)
# assert res.status_code in [403]


Expand All @@ -191,7 +191,7 @@ def test_add(
url = reverse(admin_urlname(modeladmin.model._meta, "add"))
if modeladmin.has_add_permission(Mock(user=app._user)):
res = app.get(url)
res.form.submit()
res.forms[1].submit()
assert res.status_code in [200, 302]
else:
pytest.skip("No 'add' permission")
Expand All @@ -203,7 +203,7 @@ def test_delete(app, modeladmin, record, monkeypatch):
url = reverse(admin_urlname(modeladmin.model._meta, "delete"), args=[record.pk])
if modeladmin.has_delete_permission(Mock(user=app._user)):
res = app.get(url)
res.form.submit()
res.forms[1].submit()
assert res.status_code in [200, 302]
else:
pytest.skip("No 'delete' permission")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_create_translation(django_app, simple_registration, admin_user):
# assert url == f"/en-us/register/registration-1/{simple_registration.version}/"
res = django_app.get(url, user=admin_user)
# translation-form
res = res.form.submit()
res = res.forms[1].submit()
# res = res.form.submit()
# res.form["first_name"] = "first_name"
# res.form["last_name"] = "f"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ def test_panel(panel, django_app, admin_user):
def test_panel_email(django_app, admin_user):
url = reverse("admin:email")
res = django_app.get(url, user=admin_user)
res = res.form.submit()
res = res.forms[1].submit()
assert res.status_code == 200
Loading