def django_user_conversion(obj):
    """ Convert a Django user either by returning USERNAME_FIELD or convert
    it to str.
    """
    if hasattr(obj, "USERNAME_FIELD"):
        return getattr(obj, getattr(obj, "USERNAME_FIELD"), None)
    else:
        return str(obj)