def get_first_image(obj):
    """
    Returns the first image related to the object or None
    if there is no images. The first image is the image
    with the smallest value of the 'position' field. 
    """
    images = obj.content_gallery.all().order_by('position')[:1]
    if not images:
        return None
    return images[0]
