forms.py 文件源码

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

项目:CoBL-public 作者: lingdb 项目源码 文件源码
def handle(self, request):
        data = self.data
        try:
            with transaction.atomic():
                author = Author.objects.get(
                    id=data['idField'])
                userChanged = data['user_id'] != author.user_id
                if author.isChanged(**data) or userChanged:
                    problem = author.setDelta(request, **data)
                    if problem is None:
                        if userChanged and request.user.is_staff:
                            author.user_id = data['user_id']
                        author.save()
                    else:
                        messages.error(
                            request, author.deltaReport(**problem))
        except Exception:
            logging.exception('Problem while updating author.')
            messages.error(
                request, 'Problem saving author data: %s' % data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号