'why is my list cannot be convert into zip list? python
i have 2 list that i got from input in my html i want to ouput that 2 list together but when i use zip(lista, listb) no output shown
{% for proc, ope in procslist %}
<tr>
<td style="width:10%;">{{proc.id}}</td>
<td style="width:10%;">{{proc.name}}</td>
<td style="width:10%;">{{proc.setcost}} / {{proc.proccost}}</td>
<td style="width:10%;">{{proc.id}}</td>
<td style="width:10%;">{{proc.id}}</td>
<td style="width:10%;">{{proc.id}}</td>
<td style="width:10%;">{{proc.settime}}</td>
<td style="width:10%;">
<input type="hidden" name="opetimelist" value="{{proc.id}}" id="">
<input type="text" name="opetime-{{proc.id}}" id="" value="{{ope}}"
style="width: 80%;">
</td>
</tr>
{% endfor %}
and this is my views.py
proc = ''
choosenproc = request.POST.get('choosenproc')
if choosenproc:
proc = Proc.objects.get(Q(name__icontains=choosenproc) | Q(id__icontains=choosenproc))
flag = False
if proc:
if selectedproc != []:
for product in selectedproc:
if product.id == proc.id:
flag = True
break
if flag == False:
selectedproc.append(proc)
opetimelist = request.POST.getlist('opetimelist')
opetimevalue = [request.POST['opetime-{}'.format(o)] for o in opetimelist]
procslist = zip(selectedproc, opetimevalue)
the result it no ouput
how to fix this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|