Esempio n. 1
0
def add_jobs(request):
    def _add_jobs(form):
        jobs = form.save(commit=False)
        jobs.save()
        return {'ret_code': RET_CODES["ok"]}

    return with_valid_form(JobsForm(request.POST), _add_jobs)
Esempio n. 2
0
def add_page(request):
    def _add_page(form):
        page = form.save(commit=False)
        page.account = Account.objects.get(user__pk=request.user.pk)
        page.save()
        return {'ret_code': RET_CODES["ok"]}
    return with_valid_form(PageForm(request.POST), _add_page)
def add_dishes(request):

    def _add_dishes(form):
        form.save()
        return {'ret_code': RET_CODES["ok"]}

    return with_valid_form(DishesForm(request.POST), _add_dishes)
Esempio n. 4
0
def add_talk(request):

    def _add_talk(form):
        form.save()
        return {'ret_code': RET_CODES["ok"]}

    return with_valid_form(TalkForm(request.POST), _add_talk)
Esempio n. 5
0
def edit_talk(request, id):
    talk = Talk.objects.get(pk=id)
    form = TalkForm(request.POST, instance=talk)

    def _edit_talk(form):
        form.save()
        return {"ret_code": RET_CODES["ok"]}

    return with_valid_form(form, _edit_talk)
Esempio n. 6
0
def edit_jobs(request, id):
    jobs = Jobs.objects.get(pk=id)
    form = JobsForm(request.POST, instance=jobs)

    def _edit_jobs(form):
        form.save()
        return {'ret_code': RET_CODES["ok"]}

    return with_valid_form(form, _edit_jobs)
Esempio n. 7
0
def edit_show(request, id):
    show = Magician_Show.objects.get(pk=id)
    form = ShowForm(request.POST, instance=show)

    def _edit_show(form):
        form.save()
        return {'ret_code': RET_CODES["ok"]}

    return with_valid_form(form, _edit_show)
Esempio n. 8
0
def edit_jobs(request, id):
    jobs = Jobs.objects.get(pk=id)
    form = JobsForm(request.POST, instance=jobs)

    def _edit_jobs(form):
        form.save()
        return {'ret_code': RET_CODES["ok"]}

    return with_valid_form(form, _edit_jobs)
def edit_dishes(request, id):
    dishes = Dishes.objects.get(pk=id)
    form = DishesForm(request.POST, instance=dishes)

    def _edit_dishes(form):
        form.save()
        return {'ret_code': RET_CODES["ok"]}

    return with_valid_form(form, _edit_dishes)
Esempio n. 10
0
def edit_talk(request, id):
    talk = Talk.objects.get(pk=id)
    form = TalkForm(request.POST, instance=talk)

    def _edit_talk(form):
        form.save()
        return {'ret_code': RET_CODES["ok"]}

    return with_valid_form(form, _edit_talk)
Esempio n. 11
0
def edit_page(request, id):
    account = Account.objects.get(user__pk=request.user.pk)
    page = Page.objects.get(pk=id, account=account)
    form = PageForm(request.POST, instance=page)

    def _edit_page(form):
        form.save()
        if len(PageItem.objects.filter(page=page)) > 0:
            wps.emitChangeEvent(account)
        return {'ret_code': RET_CODES["ok"]}

    return with_valid_form(form, _edit_page)
Esempio n. 12
0
def add_jobs(request):
    def _add_jobs(form):
        jobs = form.save(commit=False)
        jobs.save()
        return {'ret_code': RET_CODES["ok"]}
    return with_valid_form(JobsForm(request.POST), _add_jobs)