current position:Home>[Django CI system] if the front-end date is complete, it will be fully updated to the back-end; If the front-end date is incomplete, the date will not be updated to the back-end-20220510

[Django CI system] if the front-end date is complete, it will be fully updated to the back-end; If the front-end date is incomplete, the date will not be updated to the back-end-20220510

2022-05-15 03:36:31i see the future

If the front date is complete , Then fully update to the back end ; If the front date is incomplete , The date is not updated to the back end .

Do this project through multiple judgments .

    #  obtain POST data 
    pk = request.POST.get('pk', '')
    dept_review_suggestion_employee_id = request.POST.get('dept_review_suggestion_employee_id', '')
    dept_review_suggestion_subject = request.POST.get('dept_review_suggestion_subject', '')
    dept_review_suggestion_problem = request.POST.get('dept_review_suggestion_problem', '')
    dept_review_suggestion_date = request.POST.get('dept_review_suggestion_date', '')
    dept_review_feasibility = request.POST.get('dept_review_feasibility','')
    dept_review_plan_date = request.POST.get('dept_review_plan_date','')
    dept_review_actual_date = request.POST.get('dept_review_actual_date','')
    dept_review_saving = request.POST.get('dept_review_saving','')
    dept_review_remark = request.POST.get('dept_review_remark','')

    ''' to update dept_review Model '''
    #  If the date is complete , Then it will be fully updated ; If the date is incomplete , The date is not updated .
    if dept_review_plan_date and dept_review_actual_date:
        dept_review_suggestion_self = dept_review.objects.\
            filter(Q(pk=pk) & Q(dept_review_suggestion_employee_id=dept_review_suggestion_employee_id) \
                & Q(dept_review_suggestion_subject=dept_review_suggestion_subject) \
                & Q(dept_review_suggestion_problem=dept_review_suggestion_problem) \
                & Q(dept_review_suggestion_date=dept_review_suggestion_date)).\
            update(
                dept_review_feasibility = dept_review_feasibility,
                dept_review_plan_date = dept_review_plan_date,
                dept_review_actual_date = dept_review_actual_date,
                dept_review_saving = dept_review_saving,
                dept_review_remark = dept_review_remark,
                    )
    elif dept_review_plan_date and not dept_review_actual_date:
        dept_review_suggestion_self = dept_review.objects.\
            filter(Q(pk=pk) & Q(dept_review_suggestion_employee_id=dept_review_suggestion_employee_id) \
                & Q(dept_review_suggestion_subject=dept_review_suggestion_subject) \
                & Q(dept_review_suggestion_problem=dept_review_suggestion_problem) \
                & Q(dept_review_suggestion_date=dept_review_suggestion_date)).\
            update(
                dept_review_feasibility = dept_review_feasibility,
                dept_review_plan_date = dept_review_plan_date,
                dept_review_saving = dept_review_saving,
                dept_review_remark = dept_review_remark,
                    )
    elif not dept_review_plan_date and dept_review_actual_date:
        dept_review_suggestion_self = dept_review.objects.\
            filter(Q(pk=pk) & Q(dept_review_suggestion_employee_id=dept_review_suggestion_employee_id) \
                & Q(dept_review_suggestion_subject=dept_review_suggestion_subject) \
                & Q(dept_review_suggestion_problem=dept_review_suggestion_problem) \
                & Q(dept_review_suggestion_date=dept_review_suggestion_date)).\
            update(
                dept_review_feasibility = dept_review_feasibility,
                dept_review_actual_date = dept_review_actual_date,
                dept_review_saving = dept_review_saving,
                dept_review_remark = dept_review_remark,
                    )
    else:
        dept_review_suggestion_self = dept_review.objects.\
            filter(Q(pk=pk) & Q(dept_review_suggestion_employee_id=dept_review_suggestion_employee_id) \
                & Q(dept_review_suggestion_subject=dept_review_suggestion_subject) \
                & Q(dept_review_suggestion_problem=dept_review_suggestion_problem) \
                & Q(dept_review_suggestion_date=dept_review_suggestion_date)).\
            update(
                dept_review_feasibility = dept_review_feasibility,
                dept_review_saving = dept_review_saving,
                dept_review_remark = dept_review_remark,
                    )

 Insert picture description here

copyright notice
author[i see the future],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/131/202205111536123870.html

Random recommended