def modelrepr(instance) -> str:
    """
    Default ``repr`` version of a Django model object, for debugging.
    """
    elements = []
    # noinspection PyProtectedMember
    for f in instance._meta.get_fields():
        # https://docs.djangoproject.com/en/2.0/ref/models/meta/
        if f.auto_created:
            continue
        if f.is_relation and f.related_model is None:
            continue
        fieldname = f.name
        try:
            value = repr(getattr(instance, fieldname))
        except ObjectDoesNotExist:
            value = "<RelatedObjectDoesNotExist>"
        elements.append("{}={}".format(fieldname, value))
    return "<{} <{}>>".format(type(instance).__name__,
                              ", ".join(elements))
Default ``repr`` version of a Django model object, for debugging.