Commit c75e2651 authored by Lars Kruse's avatar Lars Kruse

fix Python style checks

"make test" now succeeds with the Python-based tests
parent 7d1cd26b
Pipeline #1244 failed with stage
in 3 seconds
......@@ -3,4 +3,4 @@ max-line-length = 99
exclude = */migrations, node_modules, stadt/settings/local.py, build,
.pybuild, debian/stadtgestalten, debian/tmp, debian/root,
gitlab-ci-build-venv
ignore = E121,E123,E126,E226,E24,E704,W503
ignore = E121,E123,E126,E226,E24,E704,W503,N802
......@@ -15,13 +15,13 @@ class Association(models.QuerySet):
query = models.Q(public=True)
# authenticated users can view associations for entities they are members in
if user.is_authenticated:
GESTALT_TYPE = contenttypes.ContentType.objects.get_for_model(gestalten.Gestalt)
GROUP_TYPE = contenttypes.ContentType.objects.get_for_model(groups.Group)
gestalt_type = contenttypes.ContentType.objects.get_for_model(gestalten.Gestalt)
group_type = contenttypes.ContentType.objects.get_for_model(groups.Group)
gestalt_groups = groups.Group.objects.filter(memberships__member=user.gestalt)
query |= (
(models.Q(entity_type=GROUP_TYPE)
(models.Q(entity_type=group_type)
& models.Q(entity_id__in=gestalt_groups))
| (models.Q(entity_type=GESTALT_TYPE)
| (models.Q(entity_type=gestalt_type)
& models.Q(entity_id=user.gestalt.id))
)
# if given a container we can allow access to associations for which the user
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment