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

Feature/remove django choices #11

Merged
merged 8 commits into from
Sep 18, 2023
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ scripts =
bin/use_external_components
install_requires =
django>=3.2.0,<4.2
django-choices
django-filter>=2.0
django-solo
djangorestframework~=3.12.0
Expand All @@ -53,6 +52,7 @@ install_requires =
PyJWT>=2.0.0
pyyaml
requests
coreapi
joeribekker marked this conversation as resolved.
Show resolved Hide resolved
tests_require =
pytest
pytest-django
Expand Down
5 changes: 4 additions & 1 deletion vng_api_common/audittrails/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,17 @@ def create_audittrail(
toelichting = get_header(self.request, "X-Audit-Toelichting") or ""

logrecord_id = get_header(self.request, "X-NLX-Logrecord-ID") or ""
action_labels = dict(
zip(CommonResourceAction.names, CommonResourceAction.labels)
)

trail = AuditTrail(
bron=self.audit.component_name,
logrecord_id=logrecord_id,
applicatie_id=app_id,
applicatie_weergave=app_presentation,
actie=action,
actie_weergave=CommonResourceAction.labels.get(action, ""),
actie_weergave=action_labels.get(action, ""),
gebruikers_id=user_id,
gebruikers_weergave=user_representation,
resultaat=status_code,
Expand Down
7 changes: 3 additions & 4 deletions vng_api_common/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from typing import Any

from django.core.checks import Warning, register

from djchoices import DjangoChoices
from django.db.models import Choices

from .utils import get_subclasses

Expand All @@ -28,8 +27,8 @@ def check_lowercased_constants(app_configs, **kwargs):
"""
warnings = []

for klass in get_subclasses(DjangoChoices):
enum_values = klass.values.keys()
for klass in get_subclasses(Choices):
enum_values = klass.values
if any((not enum_value_ok(value) for value in enum_values)):
warnings.append(
Warning(
Expand Down
Loading