These are chat archives for django/django

2nd
Dec 2018
johndiego
@johndiego
Dec 02 2018 00:00
look my view
but in my method post
fsecada01
@fsecada01
Dec 02 2018 00:01
that is not helpful
what is your problem
what are you trying to do
johndiego
@johndiego
Dec 02 2018 00:01
I'm trying values in formset!
in method posts
fsecada01
@fsecada01
Dec 02 2018 00:02
what values
again, what is your use case
what are you trying to do with formset
johndiego
@johndiego
Dec 02 2018 00:03
get values

class FormLoteContasReceber(View):
    def get(self, request):
        lista_lote = []
        lista = request.GET.getlist('lotes[]')
        processo  =  ProcessoLote.objects.filter(pk__in=lista,lote_os__isnull=False)
        empresa  = Empresa.objects.get(pk=processo[0].id_empresa)
        trinta_dias = datetime.now()+timedelta(days=30)
        lancamento = datetime.now().strftime("%d/%m/%Y ")
        initial ={'tipo_conta':'0','empresa': empresa, 'data_vencimento':trinta_dias.strftime("%d/%m/%Y ")}

        for x in processo:
            if x.pedagio_separado:
                dic = {
                'cod_lote': x.pk,
                'valor_total':x.total_pedagio,
                'acrescimos':0,
                'descontos':0
                }
                lista_lote.append(dic)
                dic = {
                    'cod_lote': x.pk,
                    'valor_total': x.total_lote,
                    'acrescimos':0,
                    'descontos':0
                }

                lista_lote.append(dic)
            else:
                dic = {
                'cod_lote': x.pk,
                'valor_total':(x.total_pedagio + x.total_lote),
                'acrescimos':0,
                'descontos':0
                }
                lista_lote.append(dic)
        form = ContasReceberLoteFormHeader( initial = initial)
        ContasReceberFormSet = formset_factory(ContasReceberLoteBody,max_num=0)

        formset = ContasReceberFormSet(initial = lista_lote)
        return TemplateResponse(request,'lotes/form_lote_conta_receber.html',{'form':form,'cr':formset})
    def post(self, request):
        form = ContasReceberLoteFormHeader( request.POST)
        formset = ContasReceberLoteBody(request.POST)
        if formset.is_valid():
            return TemplateResponse(request,'lotes/form_lote_conta_receber.html',{'form':form,'cr':formset})
        return TemplateResponse(request,'lotes/form_lote_conta_receber.html',{'form':form,'cr':formset})
this generate screeam
Deepin Screenshot_20181130222217.png
johndiego
@johndiego
Dec 02 2018 00:45
how get values in method posts in formset
johndiego
@johndiego
Dec 02 2018 00:56
how get values django?
johndiego
@johndiego
Dec 02 2018 03:57
?
johndiego
@johndiego
Dec 02 2018 04:59
guys
I find my error