Skip to content

Commit

Permalink
Merge pull request #11 from maykinmedia/feature/remove-django-choices
Browse files Browse the repository at this point in the history
Feature/remove django choices
  • Loading branch information
annashamray authored Sep 18, 2023
2 parents b8ea21a + 623e987 commit 0ab2f49
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 317 deletions.
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
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

0 comments on commit 0ab2f49

Please sign in to comment.