def data_tab(request, voucher_group, template_name="manage/voucher/data.html"): """Displays the data tab of the passed voucher group. """ if request.method == "POST": form = VoucherGroupForm(instance=voucher_group, data=request.POST) if form.is_valid(): form = VoucherGroupForm(instance=voucher_group) else: form = VoucherGroupForm(instance=voucher_group) return render_to_string(template_name, RequestContext(request, { "voucher_group": voucher_group, "form": form, }))
def save_voucher_group_data(request, id): """Saves the data of the voucher group with passed id. """ voucher_group = VoucherGroup.objects.get(pk=id) form = VoucherGroupForm(instance=voucher_group, data=request.POST) if form.is_valid(): voucher_group = form.save() _update_positions() voucher_group = VoucherGroup.objects.get(pk=voucher_group.id) return render_to_ajax_response(( ("#data_tab", data_tab(request, voucher_group)), ("#navigation", navigation(request, voucher_group)), ), _(u"Voucher data has been saved."))
def save_voucher_group_data(request, id): """Saves the data of the voucher group with passed id. """ voucher_group = VoucherGroup.objects.get(pk=id) form = VoucherGroupForm(instance=voucher_group, data=request.POST) if form.is_valid(): voucher_group = form.save() _update_positions() voucher_group = VoucherGroup.objects.get(pk=voucher_group.id) return render_to_ajax_response( (("#data_tab", data_tab(request, voucher_group)), ("#navigation", navigation(request, voucher_group)),), _(u"Voucher data has been saved."))
def data_tab(request, voucher_group, template_name="manage/voucher/data.html"): """Displays the data tab of the passed voucher group. """ if request.method == "POST": form = VoucherGroupForm(instance=voucher_group, data=request.POST) if form.is_valid(): form = VoucherGroupForm(instance=voucher_group) else: form = VoucherGroupForm(instance=voucher_group) return render_to_string( template_name, RequestContext(request, { "voucher_group": voucher_group, "form": form, }))