I have a template in which i need to run two for loop simultanously. For example:
#pseudocode
{% for x in one%} and {% for y in two %}
{{x}}, {{y}}
{% endfor %}
PS: The above code is pseudo. I also found a package to do it i.e. Djnago-multiforloop
Is there any other way to do it ?
Updated!
I have a dictionary with named objects
in python like this:
{<User: x>: True, <User: y>: False}
Now i want to use these value in my Django-template code:
{% for share_user in objects %} and {% for key, value in objects.iteritems %}
<tr>
<td>{{ share_user }}</td>
<td><a href="{% url share_edit type type.pk share_user.id %}">{{ value}}</a></td>
</tr>
{% endfor %}
I want to merge the two for loop
so that the below code in template work successfully.
Desired output: For the first iteration:
x
True
For the second iteration:
Y
False
In my views.py:
permission_obj = somemodels.objects.filter(object_id=object_id)
for perm in permission_obj:
s_user.append(perm.user)
s_edit.append(perm.edit)
objects = dict(zip(s_user,s_edit))
extra_context = {
'objects' : objects
}