0

I have a form raising a ValidationError in admin panel, like this

class HistoryForm(forms.ModelForm):
    class Meta:
        model = History
        fields = '__all__'

    def clean(self):
        raise ValidationError("A history error")

When the ValidationError is raised, the admin page always showing "Please correct the error below." with the error message "A history error".

Now I want to show the error message "A history error" only without "Please correct the error below.", how can I achieve it?

I want a method without modifying template.

1 Answer 1

2

That message comes with the default admin change_form.html template. In order to remove it, you'll have to override the chagne_form.html template.

Sign up to request clarification or add additional context in comments.

2 Comments

is there a solution that don't need to adjust template
Unfortunately, No. You have to override it to change the default behaviour. You can just copy-paste the template without that message in you new template. It is quite simple.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.