diff --git a/README.md b/README.md index bbfc086..5816f10 100644 --- a/README.md +++ b/README.md @@ -306,7 +306,15 @@ class Course(BaseModel): Now, if we try to create new object via `course.save()` or via `Course.objects.create(...)`, we are going to get an `IntegrityError`, rather than a `ValidationError`. -This can actually be a downside to the approach, because now, we have to deal with the `IntegrityError`, which does not always have the best error message. +This can actually be a downside (_this is not the case, starting from Django 4.1. Check the extra section below._) to the approach, because now, we have to deal with the `IntegrityError`, which does not always have the best error message. + +> 👀 ⚠️ 👀 Since Django 4.1, calling `.full_clean` will also check model constraints! +> +> This actually removes the downside, mentioned above, since you'll get a nice `ValidationError`, if your model constraints fail the check (if you go thru `Model.objects.create(...)` the downside still holds) +> +> More on this, here - +> +> For an example test case, check the Styleguide-Example repo - The Django's documentation on constraints is quite lean, so you can check the following articles by Adam Johnson, for examples of how to use them: