def get_links_for(obj, is_external=None):

    params = dict(object_id=obj.id, content_type__app_label=obj._meta.app_label,
        content_type__model=obj._meta.model_name)

    if not (is_external is None):
        params["is_external"] = is_external

    return GenericLink.objects.filter(**params)
Returns a queryset with all instances of GenericLink for a given object
dataset/ETHPy150Open matagus/django-generic-links/generic_links/utils.py/get_links_for