When a task instance is created, create also an item relation.

def add_parent(sender, instance, **kwargs):
    """
    When a task instance is created, create also an item relation.
    """
    if not kwargs['created']:
        return
    for att in ['task', 'context']:
        parent = getattr(instance, att).item_id
        child = instance.item_id
        ItemRelation.objects.get_or_create(
            parent_id=parent,
            child_id=child,
            visible=True,
        )