当前位置: 首页>>代码示例>>Python>>正文


Python ResultForm.generate_barcode方法代码示例

本文整理汇总了Python中tally_ho.apps.tally.models.result_form.ResultForm.generate_barcode方法的典型用法代码示例。如果您正苦于以下问题:Python ResultForm.generate_barcode方法的具体用法?Python ResultForm.generate_barcode怎么用?Python ResultForm.generate_barcode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tally_ho.apps.tally.models.result_form.ResultForm的用法示例。


在下文中一共展示了ResultForm.generate_barcode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from tally_ho.apps.tally.models.result_form import ResultForm [as 别名]
# 或者: from tally_ho.apps.tally.models.result_form.ResultForm import generate_barcode [as 别名]
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        self.initial = {
            'tally_id': tally_id,
        }
        del self.request.session['result_form']
        pk = self.request.session.get('result_form')

        if pk:
            result_form = ResultForm.objects.get(pk=pk, tally__id=tally_id)
        else:
            tally = Tally.objects.get(id=tally_id)
            barcode = ResultForm.generate_barcode(tally_id)
            result_form = ResultForm.objects.create(
                barcode=barcode,
                form_state=FormState.CLEARANCE,
                tally=tally)
            self.request.session['result_form'] = result_form.pk

        form = NewResultForm(instance=result_form)
        form_class = self.get_form_class()
        form = self.get_form(form_class)

        return self.render_to_response(self.get_context_data(
            form=form, result_form=result_form, tally_id=tally_id))
开发者ID:crononauta,项目名称:tally-ho,代码行数:27,代码来源:clearance.py

示例2: get

# 需要导入模块: from tally_ho.apps.tally.models.result_form import ResultForm [as 别名]
# 或者: from tally_ho.apps.tally.models.result_form.ResultForm import generate_barcode [as 别名]
    def get(self, *args, **kwargs):
        pk = self.request.session.get('result_form')

        if pk:
            result_form = ResultForm.objects.get(pk=pk)
        else:
            barcode = ResultForm.generate_barcode()
            result_form = ResultForm.objects.create(
                barcode=barcode,
                form_state=FormState.CLEARANCE)
            self.request.session['result_form'] = result_form.pk

        form = NewResultForm(instance=result_form)
        form_class = self.get_form_class()
        form = self.get_form(form_class)

        return self.render_to_response(self.get_context_data(
            form=form, result_form=result_form))
开发者ID:lnabergoi,项目名称:tally-ho,代码行数:20,代码来源:clearance.py


注:本文中的tally_ho.apps.tally.models.result_form.ResultForm.generate_barcode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。