Python django.views.generic.edit 模块,DeleteView() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用django.views.generic.edit.DeleteView()

项目:mendelmd    作者:raonyguimaraes    | 项目源码 | 文件源码
def get_context_data(self, **kwargs):
        context = super(GenesetDetailView, self).get_context_data(**kwargs)
        return context

# class GenesetDeleteView(DeleteView):
#     def get_object(self, queryset=None):
#         """ Hook to ensure object is owned by request.user. """
#         obj = super(GenesetDeleteView, self).get_object()
#         if not obj.owner == self.request.user:
#             raise Http404
#         return obj
项目:foundation    作者:altio    | 项目源码 | 文件源码
def get_context_data(self, **kwargs):
        object_name = force_text(self.object._meta.verbose_name)

        # Populate deleted_objects, a data structure of all related objects that
        # will also be deleted.
        (deleted_objects, model_count, perms_needed, protected) = get_deleted_objects(
            [self.object], self.object._meta, self.request.user,
            self.backend, router.db_for_write(self.model))

        kwargs.update(
            object_name=object_name,
            deleted_objects=deleted_objects,
            model_count=dict(model_count).items(),
        )
        return super(DeleteView, self).get_context_data(**kwargs)