Пример #1
0
 def get(self, request, *args, **kwargs):
     slug = kwargs["slug"]
     self.key = get_object_or_404(models.SharedExhibitKey, slug=slug)
     self.exhibit = self.key.exhibit
     if not self.exhibit.dataset_available(self.exhibit.owner):
         raise Http404
     return JSONResponse(self.get_json())
Пример #2
0
    def get(self, request, *args, **kwargs):
        tx_id = kwargs["tx_id"]

        tx = get_object_or_404(models.DataSourceTransaction, tx_id=tx_id)
        if not self.request.user.has_perm('datasourcetransaction.can_view',
                                          tx):
            raise Http404

        return JSONResponse(tx.result)
Пример #3
0
    def get(self, request, *args, **kwargs):
        owner = kwargs["owner"]
        slug = kwargs["slug"]

        ds = get_object_or_404(models.Dataset,
                               owner__username=owner,
                               slug=slug)
        user = self.request.user

        if not user.has_perm("dataset.can_view", ds):
            raise Http404

        return JSONResponse(self.get_doc(ds))
Пример #4
0
    def get(self, request, *args, **kwargs):
        owner = kwargs["owner"]
        slug = kwargs["slug"]

        exhibit = get_object_or_404(models.Exhibit,
                                    owner__username=owner,
                                    slug=slug)
        user = self.request.user

        if not user.has_perm("exhibit.can_view", exhibit):
            raise Http404

        return JSONResponse(exhibit.profile)
Пример #5
0
    def get(self, request, *args, **kwargs):
        owner = kwargs["owner"]
        slug = kwargs["slug"]

        ds = get_object_or_404(models.Dataset,
                               owner__username=owner,
                               slug=slug)
        user = self.request.user

        if not user.has_perm("dataset.can_view", ds):
            raise Http404

        return JSONResponse({
            "theme": conf.DEFAULT_EXHIBIT_THEME,
            "facets": {},
            "views": {
                "views": [{
                    "id": str(uuid.uuid4()),
                    "type": "list",
                    "name": "List"
                }]
            }
        })
Пример #6
0
 def get(self, *args, **kwargs):
     content = self.get_dict(*args, **kwargs)
     return JSONResponse(content, self.template)
Пример #7
0
 def post(self, request, *args, **kwargs):
     body = self.get_body()
     data = self.transform(body=body, params=self.get_params())
     if data:
         return JSONResponse(data)
     return HttpResponseBadRequest()