Skip to content
Snippets Groups Projects
Verified Commit e9713a31 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch 'master' into 319-replace-django-easy-audit

parents 2176ec0d 0ff3ebb4
No related branches found
No related tags found
1 merge request!385Resolve "Replace django-easy-audit"
......@@ -345,11 +345,11 @@ class SuccessMessageMixin(ModelFormMixin):
return super().form_valid(form)
class AdvancedCreateView(CreateView, SuccessMessageMixin):
class AdvancedCreateView(SuccessMessageMixin, CreateView):
pass
class AdvancedEditView(UpdateView, SuccessMessageMixin):
class AdvancedEditView(SuccessMessageMixin, UpdateView):
pass
......
......@@ -227,9 +227,9 @@ class Person(ExtensibleModel):
def age_at(self, today):
if self.date_of_birth:
years = today.year - self.date_of_birth.year
if (self.date_of_birth.month > today.month
or (self.date_of_birth.month == today.month
and self.date_of_birth.day > today.day)):
if self.date_of_birth.month > today.month or (
self.date_of_birth.month == today.month and self.date_of_birth.day > today.day
):
years -= 1
return years
......@@ -389,14 +389,14 @@ class Group(SchoolTermRelatedExtensibleModel):
""" Get stats about a given group """
stats = {}
stats['members'] = len(self.members.all())
stats["members"] = len(self.members.all())
ages = [person.age for person in self.members.filter(date_of_birth__isnull=False)]
if ages:
stats['age_avg'] = sum(ages) / len(ages)
stats['age_range_min'] = min(ages)
stats['age_range_max'] = max(ages)
stats["age_avg"] = sum(ages) / len(ages)
stats["age_range_min"] = min(ages)
stats["age_range_max"] = max(ages)
return stats
......
......@@ -414,6 +414,9 @@ DBBACKUP_COMPRESS_MEDIA = _settings.get("backup.media.compress", True)
DBBACKUP_ENCRYPT_MEDIA = _settings.get("backup.media.encrypt", DBBACKUP_GPG_RECIPIENT is not None)
DBBACKUP_CLEANUP_DB = _settings.get("backup.database.clean", True)
DBBACKUP_CLEANUP_MEDIA = _settings.get("backup.media.clean", True)
DBBACKUP_CONNECTOR_MAPPING = {
"django_prometheus.db.backends.postgresql": "dbbackup.db.postgresql.PgDumpConnector",
}
IMPERSONATE = {"USE_HTTP_REFERER": True, "REQUIRE_SUPERUSER": True, "ALLOW_SUPERUSER": True}
......
[tox]
skipsdist = True
skip_missing_interpreters = true
envlist = py37,py38
envlist = py37,py38,py39
[testenv]
whitelist_externals = poetry
......@@ -22,8 +22,8 @@ setenv =
[testenv:lint]
commands =
- poetry run black --check --diff aleksis/
- poetry run isort -c --diff --stdout aleksis/
poetry run black --check --diff aleksis/
poetry run isort -c --diff --stdout aleksis/
poetry run flake8 {posargs} aleksis/
[testenv:security]
......@@ -49,9 +49,8 @@ exclude = migrations,tests
ignore = BLK100,E203,E231,W503,D100,D101,D102,D103,D104,D105,D106,D107,RST215,RST214,F821,F841,S106,T100,T101,DJ05
[isort]
profile = black
line_length = 100
multi_line_output = 3
include_trailing_comma = 1
default_section = THIRDPARTY
known_first_party = aleksis
known_django = django
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment