4👍
✅
This is an app running on Google App Engine. Here is a custom filter that will do the trick:
from google.appengine.ext.webapp import template
from django import template as django_template
def in_list(value, arg):
"""
Given an item and a list, check if the item is in the list.
Usage:
{% if item|in_list:list %}
in list
{% else %}
not in list
{% endif %}
"""
return value in arg
register = template.create_template_register()
ifinlist = register.filter(in_list)
- [Django]-Ordering in a Python module
- [Django]-Monkey patched django auth's login, now its tests fail
- [Django]-Monitoring django postgres connections
- [Django]-Weird behavior of Django translation of one word in plural and singular form
- [Django]-What is the best way to have all the timezones as choices for a Django model?
Source:stackexchange.com