def add_error(message):
    try:
        form.add_error(None, message)
    except AttributeError:
        form._errors[NON_FIELD_ERRORS] = message
def add_error(message):
    try:
        form.add_error(None, message)
    except AttributeError:
        form._errors[NON_FIELD_ERRORS] = message