Allowing request by project-slug + uuid

remotes/origin/endpoint-for-estimation-system-new
Jesús Espino 2017-06-07 11:51:06 +02:00 committed by David Barragán Merino
parent 3075db3ec2
commit 2eaf3b249c
1 changed files with 6 additions and 0 deletions

View File

@ -1036,3 +1036,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)