本文整理匯總了Python中django.views.generic.edit.View方法的典型用法代碼示例。如果您正苦於以下問題:Python edit.View方法的具體用法?Python edit.View怎麽用?Python edit.View使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.views.generic.edit
的用法示例。
在下文中一共展示了edit.View方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: resend_message
# 需要導入模塊: from django.views.generic import edit [as 別名]
# 或者: from django.views.generic.edit import View [as 別名]
def resend_message(request, pk, *args, **kwargs):
""" Function for resending an outbound message from the Message List View"""
# Get the message to be resent
orig_message = models.Message.objects.get(message_id=pk)
# Setup the python and django path
python_executable_path = pyas2init.gsettings['python_path']
managepy_path = pyas2init.gsettings['managepy_path']
# Copy the message payload to a temporary location
temp = tempfile.NamedTemporaryFile(suffix='_%s' % orig_message.payload.name, delete=False)
with open(orig_message.payload.file, 'rb+') as source:
temp.write(source.read())
# execute the django admin command "sendas2message" to transfer the file to partner
lijst = [
python_executable_path,
managepy_path,
'sendas2message',
orig_message.organization.as2_name,
orig_message.partner.as2_name,
temp.name
]
pyas2init.logger.info(_(u'Re-send message started with parameters: "%(parameters)s"'), {'parameters': str(lijst)})
try:
subprocess.Popen(lijst).pid
except Exception as msg:
notification = _(u'Errors while trying to re-send message: "%s".') % msg
messages.add_message(request, messages.INFO, notification)
pyas2init.logger.info(notification)
else:
messages.add_message(request, messages.INFO, _(u'Re-Sending the message to your partner ......'))
return HttpResponseRedirect(reverse('home'))
示例2: reports
# 需要導入模塊: from django.views.generic import edit [as 別名]
# 或者: from django.views.generic.edit import View [as 別名]
def reports(request):
return render(request, "reports.html")
# --------------------------------------------------- #
# Branch Model class Based View #