def METHOD_NAME(queryset, as_field="generated_user_stories_attr"):
    """Attach generated user stories json column to each object of the queryset.
    :param queryset: A Django issues queryset object.
    :param as_field: Attach the generated user stories as an attribute with this name.
    :return: Queryset object with the additional `as_field` field.
    """
    model = queryset.model
    sql = """SELECT json_agg(row_to_json(t))
                FROM(
                    SELECT
                        userstories_userstory.id,
                        userstories_userstory.ref,
                        userstories_userstory.subject
                FROM userstories_userstory
                WHERE generated_from_task_id = {tbl}.id) t"""
    sql = sql.format(tbl=model._meta.db_table)
    queryset = queryset.extra(select={as_field: sql})
    return queryset