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
{% endif %}
{% endwith %}

Any else have opinions on this? Barring content types, is this the
preferred method?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to