Exemple #1
0
def home():
    context = {
        'recent_datasets': Dataset.objects.visible(),
        'recent_reuses': Reuse.objects(featured=True).visible(),
        'last_post': Post.objects.published().first(),
        'rdf_links': [
            (RDF_MIME_TYPES[fmt],
             url_for('site.rdf_catalog_format', format=ext))
            for (fmt, ext) in RDF_EXTENSIONS.items()
        ]
    }
    processor = theme.current.get_processor('home')
    context = processor(context)
    return theme.render('home.html', **context)
Exemple #2
0
def home():
    context = {
        'recent_datasets': Dataset.objects.visible(),
        'recent_reuses': Reuse.objects(featured=True).visible(),
        'last_post': Post.objects.published().first(),
        'rdf_links': [
            (RDF_MIME_TYPES[fmt],
             url_for('site.rdf_catalog_format', format=ext))
            for (fmt, ext) in RDF_EXTENSIONS.items()
        ]
    }
    processor = theme.current.get_processor('home')
    context = processor(context)
    return theme.render('home.html', **context)
Exemple #3
0
    def get_context(self):
        context = super(DatasetDetailView, self).get_context()
        if not DatasetEditPermission(self.dataset).can():
            if self.dataset.private:
                abort(404)
            elif self.dataset.deleted:
                abort(410)
        context['reuses'] = Reuse.objects(datasets=self.dataset).visible()
        context['can_edit'] = DatasetEditPermission(self.dataset)
        context['can_edit_resource'] = ResourceEditPermission

        context['rdf_links'] = [(RDF_MIME_TYPES[fmt],
                                 url_for('datasets.rdf_format',
                                         dataset=self.dataset.id,
                                         format=ext))
                                for (fmt, ext) in RDF_EXTENSIONS.items()]

        return context
Exemple #4
0
    def get_context(self):
        context = super(DatasetDetailView, self).get_context()
        if not DatasetEditPermission(self.dataset).can():
            if self.dataset.private:
                abort(404)
            elif self.dataset.deleted:
                abort(410)
        context['reuses'] = Reuse.objects(datasets=self.dataset).visible()
        context['can_edit'] = DatasetEditPermission(self.dataset)
        context['can_edit_resource'] = ResourceEditPermission

        context['rdf_links'] = [
            (RDF_MIME_TYPES[fmt],
             url_for('datasets.rdf_format',
                     dataset=self.dataset.id, format=ext))
            for (fmt, ext) in RDF_EXTENSIONS.items()
        ]

        return context