OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to remove an item from a list in the Django template language?

  • Thread starter Thread starter Ruth
  • Start date Start date
R

Ruth

Guest
Is there a way to remove an item from a list in the Django template language?

I have a situation where I'm iterating through one list, and printing the first item in another list. Once the first item is printed I want to remove it from that list.

See below:

Code:
{% for item in list1 %}
     {{list2.0}}
     #remove list2.0 from list2
{% endfor %}

Thanks in advance.
<p>Is there a way to remove an item from a list in the Django template language?</p>
<p>I have a situation where I'm iterating through one list, and printing the first item in another list. Once the first item is printed I want to remove it from that list.</p>
<p>See below:</p>
<pre><code>{% for item in list1 %}
{{list2.0}}
#remove list2.0 from list2
{% endfor %}
</code></pre>
<p>Thanks in advance.</p>
 
Top