forms.py 文件源码

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

项目:CoBL-public 作者: lingdb 项目源码 文件源码
def handle(self, request):
        try:
            c = CognateClass.objects.get(id=self.data['id'])
            if c.isChanged(**self.data):
                with transaction.atomic():
                    try:
                        problem = c.setDelta(**self.data)
                        if problem is None:
                            c.save()
                        else:
                            messages.error(request, c.deltaReport(**problem))
                    except Exception:
                        logging.exception(
                            'Exception handling CognateClassEditForm.')
                        messages.error(
                            request,
                            'Sorry, the server had problems '
                            'updating the cognate set.')
        except CognateClass.DoesNotExist:
            logging.exception('Cognate class does not exist in database.')
            messages.error(
                request,
                "Sorry, cognate class %s does not exist on the server." %
                self.data['id'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号