views.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:MetaCI 作者: SalesforceFoundation 项目源码 文件源码
def _delete_notification(request, notification):
    if request.user != notification.user:
        return HttpResponseForbidden()
    if request.method == 'POST':
        form = DeleteNotificationForm(request.POST)
        if form.is_valid():
            if request.POST['action'] == 'Delete':
                notification.delete()
            return HttpResponseRedirect('/notifications')
    else:
        form = DeleteNotificationForm()
    return render(
        request,
        'notification/delete_notification.html',
        context={
            'form': form,
            'notification': notification,
            'notification_type': notification.__class__.__name__.replace(
                'Notification',
                '',
            ),
        },
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号