Django +4.1: How to show in templates the message from violation_error_message in UniqueConstraint

I'm lost...

In my model in I have

class Project(models.Model):

... fields ...
... save ...
... etc ...

class Meta:
        constraints = [
                 fields=['name', 'owner'], 

In my class in I have

class CreateProject(LoginRequiredMixin, CreateView):
    form_class = ProjectForm
    model = Project

    def form_valid(self, form):
            return super().form_valid(form)

In I have

class ProjectForm(forms.ModelForm):
    class Meta:
        model = Project
        fields = ("name", "description")

How do I display the message in violation_error_message when the constraint is not fulfilled?

Back to Top