'Get the name to use for the object.'

def get_context_object_name(self, obj):

    if self.context_object_name:
        return self.context_object_name
    elif hasattr(obj, '_meta'):
        return smart_str(obj._meta.object_name.lower())
    else:
        return None
