0👍
✅
If you need to do this sort of editing then it isn’t working perfectly, you should filter these entries out of your queryset inside of your view
.exclude(var1="mystring")
In the comments you state that the queryset comes from an iterable, so at the very least you’d be able to do list comprehension in the view
[i for i in queryset if i.var1 != "mystring"]
If this is something you absolutely have to do in a template, then the only way is with the complete surrounding if statement that you already have in your question
1👍
this may help you
{% if i.var1 != "mystring" %}
this simply skip mystring and loop counter also increase
- Django : 'function' object has no attribute 'ModelSelect2'
- Django and d3.tsv, not working
- ImportError: No module named corsheaders
- How to feed data from django into a modal?
- Modifying Django Command argument
Source:stackexchange.com