예제 #1
0
    def obj_get_list(self, bundle, **kwargs):

        if bundle.request.GET.get("finder"):

            if not bundle.request.location:
                raise BadRequest(
                    "Finder cannot be invoked without a location header"
                )

            if not bundle.request.user.is_authenticated():
                raise BadRequest(
                    "Finder is only available to authenticated users"
                )

            try:
                return self._finder(bundle.request)
            except ValidationError as e:
                raise BadRequest(e.messages[0])

        else:

            return ModelResource.obj_get_list(self, bundle, **kwargs)