Пример #1
0
            cache_control += ", private"
        else:
            cache_control += ", public"
        return cache_control


lmdec = last_modified(lambda request, *args, **kwargs: get_request_instance(request, *args, **kwargs).modified)

dataset_profile_json = lmdec(DatasetJSONView.as_view(model=models.DatasetProfile))

dataset_data_json = lmdec(DatasetJSONView.as_view(model=models.DatasetJSONFile))

dataset_properties_json = lmdec(DatasetJSONView.as_view(model=models.DatasetPropertiesCache))

dataset_list_by_owner = OwnerListView.as_view(template_name="dataset/dataset_list_by_owner.html",
                                               model=models.Dataset,
                                               permission = "dataset.can_view",
                                               related=("exhibits","owner"))

#----------------------------------------------------------------------------------------------------------------------#
# Dataset views


class DatasetView(OwnerSlugPermissionMixin, DetailView):

    model = models.Dataset
    object_perm = "dataset.can_view"
    template_name = "dataset/dataset_summary.html"

    def get_queryset(self):
        return self.model.objects.select_related("owner", "source")
Пример #2
0
        return JSONResponse(self.get_doc(ds))


class DataJSONView(DataProfileJSONView):
    def get_doc(self, ds):
        return ds.data


class DataPropertiesCacheJSONView(DataProfileJSONView):
    def get_doc(self, ds):
        return ds.properties_cache


dataset_list_by_owner = OwnerListView.as_view(
    template_name="dataset/dataset_list_by_owner.html",
    model=models.Dataset,
    permission="dataset.can_view")

#----------------------------------------------------------------------------------------------------------------------#
# Dataset views


class DatasetView(OwnerSlugPermissionMixin, DetailView):

    model = models.Dataset
    object_perm = "dataset.can_view"
    template_name = "dataset/dataset_summary.html"

    def get_context_data(self, **kwargs):
        context = dict(super(DatasetView, self).get_context_data(**kwargs))
        dataset = self.get_object()
Пример #3
0
        return JSONResponse(self.get_doc(ds))


class DataJSONView(DataProfileJSONView):
    def get_doc(self, ds):
        return ds.data


class DataPropertiesCacheJSONView(DataProfileJSONView):
    def get_doc(self, ds):
        return ds.properties_cache


dataset_list_by_owner = OwnerListView.as_view(template_name="dataset/dataset_list_by_owner.html",
                                               model=models.Dataset,
                                               permission = "dataset.can_view")

#----------------------------------------------------------------------------------------------------------------------#
# Dataset views

class DatasetView(OwnerSlugPermissionMixin, DetailView):

    model = models.Dataset
    object_perm="dataset.can_view"
    template_name= "dataset/dataset_summary.html"

    def get_context_data(self, **kwargs):
        context = dict(super(DatasetView, self).get_context_data(**kwargs))
        dataset = self.get_object()
        user = self.request.user