mis-clicked, continuing:
@register.filter
def A_get_B(instance):
if isinstance(instance, B):
return instance.b
try:
return instance.b
except B.DoesNotExist:
return None
and lastly, the template:
{% with a|A_get_B as b %}
{% if b %}
.. work with b
{%
All,
Currently I'm working with the following 2 models:
class A (models.Model):
...
class B (A):
somefield = ...
I have a generic views with querysets defined as:
url(r"A/view/(?P\d+)/$",
"django.views.generic.list_detail.object_detail", dict(queryset =
A.objects.all(), template_name =
2 matches
Mail list logo