fix for media bundle

changed {% if object.locale %} to {% if object.locale is defined %}