• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python form_state.form_in_state函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tally_ho.libs.views.form_state.form_in_state函数的典型用法代码示例。如果您正苦于以下问题:Python form_in_state函数的具体用法?Python form_in_state怎么用?Python form_in_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: get

    def get(self, *args, **kwargs):
        pk = self.request.session.get('result_form')
        result_form = get_object_or_404(ResultForm, pk=pk)
        form_in_state(result_form, [FormState.CORRECTION])

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


示例2: post

    def post(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')

        form_class = self.get_form_class()
        form = self.get_form(form_class)

        post_data = self.request.POST
        pk = session_matches_post_result_form(post_data, self.request)

        result_form = get_object_or_404(ResultForm, pk=pk, tally__id=tally_id)
        form_in_state(result_form, FormState.AUDIT)

        if form.is_valid():
            user = self.request.user
            audit = create_or_get_audit(post_data,
                                        user.userprofile,
                                        result_form,
                                        form)
            url = audit_action(audit, post_data, result_form, self.success_url)

            return redirect(url, tally_id=tally_id)
        else:
            return self.render_to_response(self.get_context_data(form=form,
                                           result_form=result_form,
                                           tally_id=tally_id))
开发者ID:onaio,项目名称:tally-ho,代码行数:25,代码来源:audit.py


示例3: get

    def get(self, *args, **kwargs):
        tally_id = self.kwargs['tally_id']
        pk = self.request.session.get('result_form')
        result_form = get_object_or_404(ResultForm, pk=pk, tally__id=tally_id)
        form_in_state(result_form, [FormState.CORRECTION])

        return self.corrections_response(result_form)
开发者ID:onaio,项目名称:tally-ho,代码行数:7,代码来源:corrections.py


示例4: post

    def post(self, race_type):
        post_data = self.request.POST
        pk = session_matches_post_result_form(post_data, self.request)
        result_form = get_object_or_404(ResultForm, pk=pk)
        form_in_state(result_form, FormState.CORRECTION)

        if 'submit_corrections' in post_data:
            user = self.request.user

            try:
                with transaction.atomic():
                    if result_form.reconciliationform_exists:
                        save_recon(post_data, user, result_form)

                    save_component_results(result_form, post_data, user)
                    save_general_results(result_form, post_data, user)
                    save_women_results(result_form, post_data, user)
            except ValidationError as e:
                return self.corrections_response(result_form, u"%s" % e)
            except SuspiciousOperation as e:
                self.request.session['error_message'] = u"%s" % e

                if result_form.form_state == FormState.DATA_ENTRY_1:
                    result_form.save()

                return redirect(self.failed_url)
            else:
                result_form.form_state = FormState.QUALITY_CONTROL
                result_form.save()

            return redirect(self.success_url)
        else:
            return incorrect_checks(post_data, result_form, 'corrections')
开发者ID:ben12345,项目名称:tally-ho,代码行数:33,代码来源:corrections.py


示例5: post

    def post(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        form_class = self.get_form_class()
        form = self.get_form(form_class)

        if form.is_valid():
            pk = session_matches_post_result_form(
                form.cleaned_data, self.request)
            result_form = get_object_or_404(ResultForm,
                                            pk=pk,
                                            tally__id=tally_id)
            form_in_state(result_form, [FormState.CORRECTION])

            if not result_form.corrections_passed:
                raise Exception(_(u"Results do not match."))

            save_final_results(result_form, self.request.user)
            save_unchanged_final_recon_form(result_form, self.request.user)

            result_form.form_state = FormState.QUALITY_CONTROL
            result_form.save()

            del self.request.session['result_form']

            return redirect(self.success_url, tally_id=tally_id)
        else:
            return self.form_invalid(form)
开发者ID:onaio,项目名称:tally-ho,代码行数:27,代码来源:corrections.py


示例6: post

    def post(self, *args, **kwargs):
        post_data = self.request.POST
        pk = post_data['result_form']
        result_form = get_object_or_404(ResultForm, pk=pk)
        form_in_state(result_form, FormState.CLEARANCE)
        self.request.session['result_form'] = result_form.pk

        return redirect(self.success_url)
开发者ID:lnabergoi,项目名称:tally-ho,代码行数:8,代码来源:clearance.py


示例7: get

    def get(self, *args, **kwargs):
        pk = self.request.session.get("result_form")
        result_form = get_object_or_404(ResultForm, pk=pk)
        possible_states = states_for_form(self.request.user, result_form)

        form_in_state(result_form, possible_states)

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


示例8: get

    def get(self, *args, **kwargs):
        pk = self.request.session.get('result_form')
        result_form = get_object_or_404(ResultForm, pk=pk)
        form_in_state(result_form, FormState.AUDIT)
        problems = result_form.audit.get_problems()

        return self.render_to_response(
            self.get_context_data(result_form=result_form,
                                  problems=problems))
开发者ID:ben12345,项目名称:tally-ho,代码行数:9,代码来源:audit.py


示例9: get

    def get(self, *args, **kwargs):
        pk = self.request.session.get('result_form')
        result_form = get_object_or_404(ResultForm, pk=pk)
        possible_states = states_for_form(self.request.user,
                                          [FormState.INTAKE], result_form)
        form_in_state(result_form, possible_states)

        return self.render_to_response(
            self.get_context_data(result_form=result_form, printed_url=reverse(self.printed_url, args=(pk,))))
开发者ID:ewokcillo,项目名称:tally-ho,代码行数:9,代码来源:intake.py


示例10: get

    def get(self, *args, **kwargs):
        """Display print view with a cover for audit if an audit exists
        for the form, otherwise with a cover for archive.
        """
        pk = self.request.session.get('result_form')
        result_form = get_object_or_404(ResultForm, pk=pk)
        form_in_state(result_form, FormState.QUALITY_CONTROL)

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


示例11: post

    def post(self, *args, **kwargs):
        post_data = self.request.POST
        pk = post_data['result_form']
        result_form = get_object_or_404(ResultForm, pk=pk)
        valid_form_state = result_form.form_state
        if (valid_form_state == FormState.CLEARANCE or valid_form_state == FormState.CLEARANCE_PENDING_STATE):
            form_in_state(result_form, valid_form_state)
        self.request.session['result_form'] = result_form.pk

        return redirect(self.success_url)
开发者ID:varduefr,项目名称:tally-ho,代码行数:10,代码来源:clearance.py


示例12: get

    def get(self, *args, **kwargs):
        pk = self.request.session.get('result_form')
        result_form = get_object_or_404(ResultForm, pk=pk)
        form_in_state(result_form, FormState.CLEARANCE)
        problems = result_form.clearance.get_problems()

        return self.render_to_response(
            self.get_context_data(result_form=result_form,
                                  problems=problems,
                                  printed_url = reverse(self.printed_url, args = (pk,))))
开发者ID:comocho00,项目名称:tally-ho,代码行数:10,代码来源:clearance.py


示例13: post

    def post(self, *args, **kwargs):
        post_data = self.request.POST
        pk = session_matches_post_result_form(post_data, self.request)
        result_form = get_object_or_404(ResultForm, pk=pk)
        possible_states = states_for_form(self.request.user, result_form)
        form_in_state(result_form, possible_states)

        result_form.form_state = FormState.AUDIT if result_form.audit else FormState.ARCHIVED
        result_form.save()

        return redirect(self.success_url)
开发者ID:eavcio,项目名称:tally-ho,代码行数:11,代码来源:archive.py


示例14: get

    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        pk = self.request.session.get('result_form')
        result_form = get_object_or_404(ResultForm, pk=pk)
        possible_states = states_for_form(self.request.user, result_form)

        form_in_state(result_form, possible_states)
        check_quarantine(result_form, self.request.user)

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


示例15: post

    def post(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        post_data = self.request.POST
        pk = post_data['result_form']

        result_form = get_object_or_404(ResultForm, pk=pk, tally__id=tally_id)
        form_in_state(result_form, FormState.AUDIT)

        self.request.session['result_form'] = result_form.pk

        return redirect(self.success_url, tally_id=tally_id)
开发者ID:crononauta,项目名称:tally-ho,代码行数:11,代码来源:audit.py


示例16: post

    def post(self, *args, **kwargs):
        post_data = self.request.POST

        if 'result_form' in post_data:
            pk = session_matches_post_result_form(post_data, self.request)

            result_form = get_object_or_404(ResultForm, pk=pk)
            form_in_state(result_form, FormState.AUDIT)
            del self.request.session['result_form']

            return redirect('audit')

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


示例17: get

    def get(self, *args, **kwargs):
        pk = self.request.session.get('result_form')
        result_form = get_object_or_404(ResultForm, pk=pk)
        form_in_state(result_form, [FormState.CLEARANCE])
        del self.request.session['result_form']

        error_msg = self.request.session.get('intake-error')

        if error_msg:
            del self.request.session['intake-error']

        return self.render_to_response(
            self.get_context_data(error_msg=error_msg,
                                  result_form=result_form))
开发者ID:ben12345,项目名称:tally-ho,代码行数:14,代码来源:intake.py


示例18: post

    def post(self, *args, **kwargs):
        """We arrive here after the cover has been printed and the user
        confirms this with a button click. Fetch form and if form had an audit,
        set it to audit state, otherwise to archived state.
        """
        post_data = self.request.POST
        pk = session_matches_post_result_form(post_data, self.request)
        result_form = get_object_or_404(ResultForm, pk=pk)
        form_in_state(result_form, FormState.QUALITY_CONTROL)
        tally_id = kwargs.get('tally_id')

        result_form.form_state = FormState.AUDIT if result_form.audit else\
            FormState.ARCHIVED
        result_form.save()

        return redirect(self.success_url, tally_id=tally_id)
开发者ID:onaio,项目名称:tally-ho,代码行数:16,代码来源:quality_control.py


示例19: post

    def post(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        post_data = self.request.POST

        if 'result_form' in post_data:
            pk = session_matches_post_result_form(post_data, self.request)

            result_form = get_object_or_404(ResultForm, pk=pk, tally__id=tally_id)
            form_in_state(result_form, FormState.CLEARANCE)
            del self.request.session['result_form']

            return redirect('clearance', tally_id=tally_id)

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


示例20: post

    def post(self, *args, **kwargs):
        post_data = self.request.POST

        if 'result_form' in post_data:
            pk = session_matches_post_result_form(post_data, self.request)
            result_form = get_object_or_404(ResultForm, pk=pk)
            possible_states = states_for_form(self.request.user,
                                              [FormState.INTAKE], result_form)
            form_in_state(result_form, possible_states)
            result_form.form_state = FormState.DATA_ENTRY_1
            result_form.save()

            return redirect('intaken')

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python quotations.extract_from_html函数代码示例发布时间:2022-05-27
下一篇:
Python test_base.create_tally函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap