本文整理匯總了Python中django.views.generic.edit.DeleteView.get_object方法的典型用法代碼示例。如果您正苦於以下問題:Python DeleteView.get_object方法的具體用法?Python DeleteView.get_object怎麽用?Python DeleteView.get_object使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.views.generic.edit.DeleteView
的用法示例。
在下文中一共展示了DeleteView.get_object方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_object
# 需要導入模塊: from django.views.generic.edit import DeleteView [as 別名]
# 或者: from django.views.generic.edit.DeleteView import get_object [as 別名]
def get_object(self, queryset=None):
self.story = DeleteView.get_object(self, queryset=queryset)
self.story_id = self.story.id
if self.story.editable_by(self.request.user):
return self.story
else:
raise PermissionDenied
示例2: get_object
# 需要導入模塊: from django.views.generic.edit import DeleteView [as 別名]
# 或者: from django.views.generic.edit.DeleteView import get_object [as 別名]
def get_object(self, queryset=None):
self.comment = DeleteView.get_object(self, queryset=queryset)
self.comment_id = self.comment.id
if self.comment.editable_by(self.request.user):
return self.comment
else:
raise PermissionDenied
示例3: get_object
# 需要導入模塊: from django.views.generic.edit import DeleteView [as 別名]
# 或者: from django.views.generic.edit.DeleteView import get_object [as 別名]
def get_object(self):
queryset = Listing.objects.filter(user=self.request.user)
return DeleteView.get_object(self, queryset=queryset)