本文整理汇总了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 #