-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 [#256] improved way we filter on urls in api queryparams
- Loading branch information
1 parent
e6d0247
commit 3ec6e17
Showing
7 changed files
with
183 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/openklant/components/klantinteracties/api/filterset/filters.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import uuid | ||
|
||
from django import forms | ||
|
||
from django_filters.rest_framework import filters | ||
from drf_spectacular.types import OpenApiTypes | ||
|
||
|
||
class URLViewFilter(filters.Filter): | ||
field_class = forms.URLField | ||
|
||
def filter(self, qs, value: OpenApiTypes.URI): | ||
if value: | ||
value = uuid.UUID(value.rstrip("/").split("/")[-1]) | ||
|
||
return super().filter(qs, value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.