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

dj42 #30

Closed
wants to merge 1 commit into from
Closed

dj42 #30

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
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ jobs:
strategy:
fail-fast: false
matrix:
django-version: [ "3.2", ]
django-version: [ "4.2", ]
python-version: [ "3.9", ]
experimental: [ false ]
include:
- django-version: "4.2"
python-version: "3.9"
experimental: true
# include:
# - django-version: "4.2"
# python-version: "3.9"
# experimental: true
continue-on-error: ${{ matrix.experimental }}
env:
DATABASE_URL: postgres://postgres:[email protected]:5432/aurora
Expand Down
1,875 changes: 1,004 additions & 871 deletions poetry.lock

Large diffs are not rendered by default.

71 changes: 35 additions & 36 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,80 +1,79 @@
[tool.poetry]
name = "aurora"
version = "0.1.0"
version = "0.3.0"
description = ""
authors = ["sax <[email protected]>"]
packages = [
{ include = "aurora", from = "src" },
]

[tool.poetry.dependencies]
Faker = "^14.0.0"
Faker = "^19.0.0"
Markdown = "^3.3.6"
Pillow = "^9.0.1"
Pillow = "^10"
beautifulsoup4 = "^4.12.0"
celery = "^5.2.6"
channels = {extras = ["daphne"], version = "^4.0.0"}
channels-redis = "^4.0.0"
cryptography = "*"
django = "^3"
django-admin-extra-buttons = ">=1.5.6"
django = "^4"
django-admin-extra-buttons = "^1.5"
django-admin-ordering = "*"
django-admin-sync = ">=0.7.1"
django-admin-sync = "^0.7"
django-adminactions = "^2"
django-adminfilters = "^2"
django-appconf = "^1.0.5"
django-bitfield = "^2.1"
django-click = "^2.3"
django-concurrency = "^2.4"
django-constance = "^2.8"
django-cors-headers = "^3.11.0"
django-constance = "^3.0"
django-cors-headers = "^4"
django-csp = "^3.7"
django-environ = "^0.9"
django-debug-toolbar = "^4"
django-environ = "^0.11"
django-filter = "^23"
django-flags = "^5"
django-front-door = "^0.10.0"
django-hijack = "^3.2.6"
django-import-export = "*"
django-jsoneditor = "^0.2"
django-mdeditor = "^0.1.20"
django-mptt = "^0.15"
django-picklefield = "^3.0"
django-pwa = "^1.0.10"
django-redis = "^5.2.0"
django-regex = "^0.5"
django-regex = "*"
django-reversion = "^5.0"
django-reversion-compare = "^0.15"
django-reversion-compare = "^0.16"
django-simple-captcha = "^0.5.17"
django-simple-math-captcha = "^2"
django-smart-admin = ">=2"
django-smart-admin = "^2"
django-strategy-field = "^3"
django-sysinfo = "^2"
django_regex = "*"
django-tinymce = "^3.5.0"
djangorestframework = "^3"
djangorestframework-datatables = "^0.7.0"
htmlmin = "^0.1"
jmespath = "^1.0"
jsonpickle="^2.1"
jsonpickle="^3"
natural-keys = "^2.0.0"
psycopg2-binary = "^2.9.3"
py-mini-racer = "^0.6.0"
pycryptodome = "^3.14.1"
#pyduktape2 = "^0.4.3"
pygments = "^2.14.0"
python = "^3.9"
pyquery = "^2.0.0"
qrcode = "^7.3.1"
sentry-sdk = "^1.5"
setuptools = "^65.5.0"
setuptools = "*"
social-auth-app-django = "^5.0.0"
sqlparse = "^0.4.2"
django-tinymce = "^3.5.0"
django-pwa = "^1.0.10"
django-mptt = "^0.14.0"
django-hijack = "^3.2.6"
channels = {extras = ["daphne"], version = "^4.0.0"}
channels-redis = "^4.0.0"
django-mdeditor = "^0.1.20"
djangorestframework-datatables = "^0.7.0"
django-filter = "^22.1"
django-front-door = "^0.10.0"
django-debug-toolbar = "^3"
pygments = "^2.14.0"
soupsieve = "^2.4"
pyquery = "^2.0.0"
beautifulsoup4 = "^4.12.0"
sqlparse = "^0.4.2"

[tool.poetry.dev-dependencies]
black = "^22.1.0"
black = "^23"
coverage = "*"
django-stubs = {extras = ["compatible-mypy"], version = "^4"}
django-webtest = "^1.9.7"
factory_boy = "*"
flake8 = "*"
Expand All @@ -83,17 +82,17 @@ ipython = "*"
isort = "^5.6.4"
pdbpp = "*"
pre-commit = "*"
py = "*"
pyflakes = "*"
pytest = "*"
pytest-asyncio = "*"
pytest-coverage = "^0.0"
pytest-django = "^4.1.0"
pytest-echo = "*"
pytest-pythonpath = "^0.7.3"
pytest-selenium = "^2.0"
pytest-pythonpath = "^0.7"
pytest-selenium = "^4.0"
tox = "*"
watchdog = "^2.1.6"
django-stubs = {extras = ["compatible-mypy"], version = "^1.16.0"}
watchdog = "^3"

[build-system]
requires = ["poetry-core>=1.1.4"]
Expand Down
9 changes: 4 additions & 5 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ django_find_project = true
DJANGO_SETTINGS_MODULE = aurora.config.settings
log_format = %(asctime)s %(levelname)s %(message)s
log_level = CRITICAL
python_paths = tests/extras src/
pythonpath = tests/extras src/
log_date_format = %Y-%m-%d %H:%M:%S
addopts =
--cov=aurora
Expand All @@ -24,7 +24,6 @@ markers =
admin:

python_files=test_*.py
filterwarnings =
ignore::DeprecationWarning
ignore::django.utils.deprecation.RemovedInDjango40Warning
ignore::django.utils.deprecation.RemovedInDjango41Warning
; filterwarnings =
; ignore::DeprecationWarning
; ignore::django.utils.deprecation.RemovedInDjango40Warning
13 changes: 7 additions & 6 deletions src/aurora/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@

ROOT_URLCONF = "aurora.config.urls"

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

TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
Expand All @@ -132,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 Expand Up @@ -554,7 +556,6 @@ def show_ddt(request): # pragma: no-cover
"debug_toolbar.panels.templates.TemplatesPanel",
"debug_toolbar.panels.cache.CachePanel",
"debug_toolbar.panels.signals.SignalsPanel",
"debug_toolbar.panels.logging.LoggingPanel",
"debug_toolbar.panels.redirects.RedirectsPanel",
"debug_toolbar.panels.profiling.ProfilingPanel",
]
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
2 changes: 1 addition & 1 deletion src/aurora/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def get_qrcode(content):
basewidth = 100
wpercent = basewidth / float(logo.size[0])
hsize = int((float(logo.size[1]) * float(wpercent)))
logo = logo.resize((basewidth, hsize), Image.ANTIALIAS)
logo = logo.resize((basewidth, hsize), Image.LANCZOS)
QRcode = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_H)
QRcode.add_data(content)
QRcode.make()
Expand Down
2 changes: 1 addition & 1 deletion src/aurora/ddt_panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from debug_toolbar.panels import Panel
from django.core.management import call_command
from django.template import Context, Template
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from aurora.state import state

Expand Down
6 changes: 3 additions & 3 deletions src/aurora/web/middlewares/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@


def is_admin_site(request):
parts = urlparse(request.get_raw_uri())
parts = urlparse(request.build_absolute_uri())
return re.compile(config.WAF_ADMIN_ALLOWED_HOSTNAMES).match(parts.netloc)


def is_public_site(request):
parts = urlparse(request.get_raw_uri())
parts = urlparse(request.build_absolute_uri())
return re.compile(config.WAF_REGISTRATION_ALLOWED_HOSTNAMES).match(parts.netloc)


Expand All @@ -29,7 +29,7 @@ def __call__(self, request):
if is_root(request) or request.user.is_staff:
return self.get_response(request)
else:
parts = urlparse(request.get_raw_uri())
parts = urlparse(request.build_absolute_uri())
try:
if parts.path.startswith(f"/{settings.DJANGO_ADMIN_URL}"):
if not is_admin_site(request):
Expand Down
12 changes: 6 additions & 6 deletions src/dbtemplates/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from django.http import HttpResponse
from django.shortcuts import render
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ngettext

from dbtemplates.conf import settings
from dbtemplates.models import Template, add_template_to_cache, remove_cached_template
Expand Down Expand Up @@ -147,7 +147,7 @@ def invalidate_cache(self, request, queryset):
for template in queryset:
remove_cached_template(template)
count = queryset.count()
message = ungettext(
message = ngettext(
"Cache of one template successfully invalidated.",
"Cache of %(count)d templates successfully invalidated.",
count,
Expand All @@ -160,7 +160,7 @@ def repopulate_cache(self, request, queryset):
for template in queryset:
add_template_to_cache(template)
count = queryset.count()
message = ungettext(
message = ngettext(
"Cache successfully repopulated with one template.",
"Cache successfully repopulated with %(count)d templates.",
count,
Expand All @@ -177,15 +177,15 @@ def check_syntax(self, request, queryset):
errors.append("%s: %s" % (template.name, error))
if errors:
count = len(errors)
message = ungettext(
message = ngettext(
"Template syntax check FAILED for %(names)s.",
"Template syntax check FAILED for %(count)d templates: %(names)s.",
count,
)
self.message_user(request, message % {"count": count, "names": ", ".join(errors)})
else:
count = queryset.count()
message = ungettext("Template syntax OK.", "Template syntax OK for %(count)d templates.", count)
message = ngettext("Template syntax OK.", "Template syntax OK for %(count)d templates.", count)
self.message_user(request, message % {"count": count})

check_syntax.short_description = _("Check template syntax")
Expand Down
2 changes: 1 addition & 1 deletion src/dbtemplates/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class DBTemplatesConfig(AppConfig):
Expand Down
2 changes: 1 addition & 1 deletion src/dbtemplates/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.db.models import signals
from django.template import TemplateDoesNotExist
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from natural_keys import NaturalKeyModel, NaturalKeyModelManager

from dbtemplates.conf import settings
Expand Down
6 changes: 3 additions & 3 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ 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)
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