Allowing request by project-slug + uuid

remotes/origin/endpoint-for-estimation-system-new-4.0
Jesús Espino 2017-06-07 11:51:06 +02:00 committed by Álex Hermida
parent 482e1c53f3
commit dc894b2c1b
1 changed files with 6 additions and 0 deletions

View File

@ -1078,3 +1078,9 @@ class GameViewSet(ModelCrudViewSet):
validator_class = validators.GameValidator
permission_classes = (permissions.GamePermission,)
filter_fields = ('project', 'uuid')
lookup_field = "selector"
lookup_value_regex = "[\w-]+\/[0-9a-f-]+$"
def dispatch(self, request, *args, **kwargs):
(kwargs['project__slug'], kwargs['uuid']) = kwargs.pop('selector').split("/")
return super().dispatch(request, *args, **kwargs)