-
Notifications
You must be signed in to change notification settings - Fork 0
feat: added uuid support #2
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| from django.conf.urls import url | ||
| from django.urls import include, re_path | ||
| from rest_framework.authtoken.views import obtain_auth_token | ||
|
|
||
| from river_admin.views import urls | ||
|
|
||
| urlpatterns = [ | ||
| url(r'^api-token-auth/', obtain_auth_token), | ||
| re_path(r'^api-token-auth/', obtain_auth_token), | ||
| ] + urls | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,15 +8,15 @@ | |
| from river_admin.views.serializers import StateDto, WorkflowObjectStateDto, TransitionDto, TransitionApprovalDto | ||
|
|
||
|
|
||
| @get(r'^workflow-object/identify/(?P<workflow_pk>\w+)/(?P<object_id>\w+)/$') | ||
| @get(r'^workflow-object/identify/(?P<workflow_pk>[-\w]+)/(?P<object_id>[-\w]+)/$') | ||
| def get_identifier(request, workflow_pk, object_id): | ||
| workflow = get_object_or_404(Workflow.objects.all(), pk=workflow_pk) | ||
| model_class = workflow.content_type.model_class() | ||
| workflow_object = get_object_or_404(model_class.objects.all(), pk=object_id) | ||
| return Response(str(workflow_object), status=status.HTTP_200_OK) | ||
|
|
||
|
|
||
| @get(r'^workflow-object/current-state/(?P<workflow_pk>\w+)/(?P<object_id>\w+)/$') | ||
| @get(r'^workflow-object/current-state/(?P<workflow_pk>[-\w]+)/(?P<object_id>[-\w]+)/$') | ||
| def get_current_state(request, workflow_pk, object_id): | ||
| workflow = get_object_or_404(Workflow.objects.all(), pk=workflow_pk) | ||
| model_class = workflow.content_type.model_class() | ||
|
|
@@ -26,7 +26,7 @@ def get_current_state(request, workflow_pk, object_id): | |
| return Response(StateDto(current_state).data, status=status.HTTP_200_OK) | ||
|
|
||
|
|
||
| @get(r'^workflow-object/current-iteration/(?P<workflow_pk>\w+)/(?P<object_id>\w+)/$') | ||
| @get(r'^workflow-object/current-iteration/(?P<workflow_pk>[-\w]+)/(?P<object_id>[-\w]+)/$') | ||
| def get_current_iteration(request, workflow_pk, object_id): | ||
| workflow = get_object_or_404(Workflow.objects.all(), pk=workflow_pk) | ||
| model_class = workflow.content_type.model_class() | ||
|
|
@@ -44,7 +44,7 @@ def get_current_iteration(request, workflow_pk, object_id): | |
| return Response(last_iteration, status=status.HTTP_200_OK) | ||
|
|
||
|
|
||
| @delete(r'^workflow-object/delete/(?P<workflow_pk>\w+)/(?P<object_id>\w+)/$') | ||
| @delete(r'^workflow-object/delete/(?P<workflow_pk>[-\w]+)/(?P<object_id>[-\w]+)/$') | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The view function decorated here, |
||
| def get_identifier(request, workflow_pk, object_id): | ||
| workflow = get_object_or_404(Workflow.objects.all(), pk=workflow_pk) | ||
| model_class = workflow.content_type.model_class() | ||
|
|
@@ -53,7 +53,7 @@ def get_identifier(request, workflow_pk, object_id): | |
| return Response(status=status.HTTP_200_OK) | ||
|
|
||
|
|
||
| @get(r'^workflow-object/state/list/(?P<workflow_id>\w+)/(?P<object_id>\w+)/$') | ||
| @get(r'^workflow-object/state/list/(?P<workflow_id>[-\w]+)/(?P<object_id>[-\w]+)/$') | ||
| def list_states(request, workflow_id, object_id): | ||
| workflow = get_object_or_404(Workflow.objects.all(), pk=workflow_id) | ||
| model_class = workflow.content_type.model_class() | ||
|
|
@@ -78,7 +78,7 @@ def list_states(request, workflow_id, object_id): | |
| return Response(WorkflowObjectStateDto(states, many=True).data, status=HTTP_200_OK) | ||
|
|
||
|
|
||
| @get(r'^workflow-object/transition/list/(?P<workflow_id>\w+)/(?P<object_id>\w+)/$') | ||
| @get(r'^workflow-object/transition/list/(?P<workflow_id>[-\w]+)/(?P<object_id>[-\w]+)/$') | ||
| def list_transitions(request, workflow_id, object_id): | ||
| workflow = get_object_or_404(Workflow.objects.all(), pk=workflow_id) | ||
| model_class = workflow.content_type.model_class() | ||
|
|
@@ -87,7 +87,7 @@ def list_transitions(request, workflow_id, object_id): | |
| return Response(TransitionDto(workflow.transitions.filter(object_id=workflow_object.pk), many=True).data, status=HTTP_200_OK) | ||
|
|
||
|
|
||
| @get(r'^workflow-object/transition-approval/list/(?P<workflow_id>\w+)/(?P<object_id>\w+)/$') | ||
| @get(r'^workflow-object/transition-approval/list/(?P<workflow_id>[-\w]+)/(?P<object_id>[-\w]+)/$') | ||
| def list_transition_approvals(request, workflow_id, object_id): | ||
| workflow = get_object_or_404(Workflow.objects.all(), pk=workflow_id) | ||
| model_class = workflow.content_type.model_class() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
includefunction is imported but not used in this file. It's good practice to remove unused imports to keep the code clean.