diff --git a/pombola/core/templatetags/safe_image.py b/pombola/core/templatetags/safe_image.py new file mode 100644 index 000000000..bfd9c2cf8 --- /dev/null +++ b/pombola/core/templatetags/safe_image.py @@ -0,0 +1,9 @@ +from django import template + +register = template.Library() + +@register.filter +def safe_image_width(image): + if image and hasattr(image, 'width'): + return image.width + return None diff --git a/pombola/south_africa/templates/core/organisation_people.html b/pombola/south_africa/templates/core/organisation_people.html index 3d70bba0a..7f60787ce 100644 --- a/pombola/south_africa/templates/core/organisation_people.html +++ b/pombola/south_africa/templates/core/organisation_people.html @@ -2,6 +2,7 @@ {% load pagination_tags %} {% load staticfiles %} {% load thumbnail %} +{% load safe_image %} {% block title %}{{ object.name }} People{% endblock %} @@ -45,7 +46,11 @@