Alright, here\'s my situation. I\'ve got an array of generic objects that I\'m iterating over in a django template. Those objects have a number of subclasses and I want to fig
This is an old question, but FWIW you can do this with a template filter.
@register.filter
def classname(obj):
return obj.__class__.__name__
Then in your template you can do:
{% with beer|classname as modelclass %}
{% if modelclass == "Domestic" %}US of A
{% elif modelclass == "Import" %}Somewhere else
{% endif %}
{% endwith %}