from typing import OrderedDict


def get_rel_attnames(view):
    """
    Return a map of {resource rel name: model attname} for a view.
    """
    if view.relationships is None:
        return OrderedDict()
    return OrderedDict((rel.relname, rel.attname) for rel in view.relationships)