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


Python edit.View方法代碼示例

本文整理匯總了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')) 
開發者ID:abhishek-ram,項目名稱:pyas2,代碼行數:35,代碼來源:views.py

示例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 # 
開發者ID:MicroPyramid,項目名稱:micro-finance,代碼行數:8,代碼來源:views.py


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