Skip to content

Commit

Permalink
fix(validation): fix initialization of validator classes
Browse files Browse the repository at this point in the history
  • Loading branch information
anehx committed Mar 15, 2024
1 parent 3a76b16 commit 35df469
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion generic_permissions/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def ready(self):
)

self._init_config(
"GENERIC_PERMISSIONS_VALIDATOR_CLASSES", [], [ValidatorsConfig]
"GENERIC_PERMISSIONS_VALIDATION_CLASSES", [], [ValidatorsConfig]
)

def _init_config(self, setting_name, defaults, configs):
Expand Down
4 changes: 4 additions & 0 deletions generic_permissions/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ def validate(self, *args, **kwargs):
):
validated_data = method(validated_data, context=self.context)
return validated_data


class PassThrough:
pass
2 changes: 1 addition & 1 deletion tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

GENERIC_PERMISSIONS_PERMISSION_CLASSES = ["generic_permissions.permissions.AllowAny"]
GENERIC_PERMISSIONS_VISIBILITY_CLASSES = ["generic_permissions.visibilities.Any"]
GENERIC_PERMISSIONS_VALIDATION_CLASSES = ["generic_permissions.validations.PassThrough"]
GENERIC_PERMISSIONS_VALIDATION_CLASSES = ["generic_permissions.validation.PassThrough"]

ROOT_URLCONF = "tests.urls"

Expand Down

0 comments on commit 35df469

Please sign in to comment.