當前位置: 首頁>>代碼示例>>Python>>正文


Python DeleteView.delete方法代碼示例

本文整理匯總了Python中django.views.generic.edit.DeleteView.delete方法的典型用法代碼示例。如果您正苦於以下問題:Python DeleteView.delete方法的具體用法?Python DeleteView.delete怎麽用?Python DeleteView.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在django.views.generic.edit.DeleteView的用法示例。


在下文中一共展示了DeleteView.delete方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: delete

# 需要導入模塊: from django.views.generic.edit import DeleteView [as 別名]
# 或者: from django.views.generic.edit.DeleteView import delete [as 別名]
    def delete(self, request, *args, **kwargs):
        relacion = self.get_object()
        (validez, mensaje) = self.valid_eliminar_rel(relacion)
        if validez:
            messages.success(request, mensaje)

            return DeleteView.delete(self, request, *args, **kwargs)

        else:
            messages.error(request, "ERROR : " + mensaje)
            return redirect(self.get_success_url())

        return DeleteView.delete(self, request, *args, **kwargs)
開發者ID:nelsondspy,項目名稱:projectmn,代碼行數:15,代碼來源:view_itemrelacion.py

示例2: delete

# 需要導入模塊: from django.views.generic.edit import DeleteView [as 別名]
# 或者: from django.views.generic.edit.DeleteView import delete [as 別名]
    def delete(self, request, *args, **kwargs):
        application = Application.objects.get(person = self.request.user, id = self.kwargs['pk'])

        # We do not want the user to delete an application already approved
        # this will mess up with class counts and expectations
        if not application.approved:
            # Delete application permit file associated with this application
            try:
                applicationpermit = ApplicationPermit.objects.get(application = application)

                if logger.isEnabledFor(logging.DEBUG):
                    logger.debug("İzin yazısı silindi: %s , request.user='%s' , request.META['REMOTE_ADDR']='%s'" %
                                 (applicationpermit, request.user, request.META["REMOTE_ADDR"]))

                applicationpermit.delete()
                messages.info(request, _('Your previously uploaded permit is deleted'))
            except ApplicationPermit.DoesNotExist:
                pass

            messages.info(request, _('Your application is deleted'))
            messages.info(request, _('Your previous choices for this event are deleted'))

            if logger.isEnabledFor(logging.DEBUG):
                logger.debug("Başvuru silindi: %s , request.user='%s' , request.META['REMOTE_ADDR']='%s'" %
                             (application, request.user, request.META["REMOTE_ADDR"]))

            return DeleteView.delete(self, request, *args, **kwargs)

        else:
            messages.error(request, _('You are not allowed to cancel an application after it is approved'))
            return render_to_response('kurs/hata.html',
                        context_instance=RequestContext(request))
開發者ID:ebayer,項目名稱:lkd-kurs,代碼行數:34,代碼來源:views.py


注:本文中的django.views.generic.edit.DeleteView.delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。