Thanks for your help, My problem I've solved. David Nugent says that the 
template must be built with using 'POST', and also the grid (table) is from 
database table, then the name  in each row I put the ID (numeric), 
therefore in view get the value with: 
valor_saca = request.POST.get(str(sigma.id_reg)) # obligadamente debe ser 
string
Here is important the 'str', it must be string (chracter, or no numeric)

(Excuse me my english )
Regards      


El miércoles, 29 de septiembre de 2021 a las 16:58:11 UTC-3, 
adeyem...@gmail.com escribió:

> Based on my observation. Your form doesn't have it's href attribute, 
> secondly in the view, the function should ve a post method and not get, 
> thirdly back to the template, u should have a name attribute for ur input 
> tag which u do but the value should be an arbitrary name or any name of ur 
> choice as a string which u will use to reference in the view function.
>
> Little modification to ur view function:
> To reference the input name attribute lets give it a value called para.
>
> def parasalidaView(request):
>         if request.method == 'POST'
>                 parasalida = Parasalida.objects.all()
>                 a_prueba = []
>                 for cue in parasalida:
>                         data = request.POST.get('para')
>                         a_prueba.append(data)
>                 
>
>
> On Wed, 29 Sep 2021, 00:38 David Nugent, <dav...@uniquode.io> wrote:
>
>> Request.GET can't apply when processing a POST request.
>>
>> You are quoting 'cur.id_reg' when accessing the GET (should be POST) 
>> params and it probably should not be - you need to access the "name" 
>> attribute that your form uses. You should also be using cleaned_data 
>> <https://docs.djangoproject.com/en/3.2/ref/forms/api/> after using 
>> proper form validation, and in this case you should probably be using a f
>> ormset <https://docs.djangoproject.com/en/3.2/topics/forms/formsets/> 
>> instead 
>> of manually generating a multiple record input form.
>>
>> HTH, David
>>
>> On Wed, Sep 29, 2021 at 7:15 AM Gabriel Araya Garcia <
>> gabriela...@gmail.com> wrote:
>>
>>> I have one grid
>>>
>>> <form name="form" method="POST">
>>>        </div>
>>>                     {% for pr in parasalida %}
>>>                           <tr style="font-size:14px">
>>>                             <td>{{ pr.estado}}</td>
>>>                             <td>{{ pr.fecha_ing|date:'d-m-Y'}}</td>
>>>                             <td>{{ pr.lote}}</td>
>>>                             <td>{{ pr.oc_ascoex}}</td>
>>>                             <td>{{ pr.cantidad}}</td>
>>>                             <td>{{ pr.extraida}}</td>
>>>                             <td><input type="number" 
>>> name='{{pr.id_reg}}' class='saca' value="{{saca_x}}" placeholder='0'/></td>
>>>
>>>                           </tr>
>>>                     {% endfor %}
>>>
>>> but, I don't know how to get the value in view:
>>>
>>>     parasalida = Parasalida.objects.all() 
>>>     a_prueba = []
>>>     for cur in parasalida:
>>>         saca_x = request.GET.get('cur.id_reg') #  template's value 
>>> according to name property
>>>         a_prueba.append(saca_x)
>>>
>>> The list is full with  [None,None,None,..]
>>>
>>> All others fields are already with values. The only values that user 
>>> input is "input text"
>>>
>>> Thank for your help
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/a2ba10d5-639e-4a08-88fe-a4206e18c249n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/a2ba10d5-639e-4a08-88fe-a4206e18c249n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAE5VhgWG3AjQD_vASX%3DG%2BpgmNdg9FVc6VSEn-dCf%3DjiNuPncwQ%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/django-users/CAE5VhgWG3AjQD_vASX%3DG%2BpgmNdg9FVc6VSEn-dCf%3DjiNuPncwQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6ffed308-dcbb-4849-b67d-7ac2878b82cbn%40googlegroups.com.

Reply via email to