I'm currently using django's clean() method to implement custom validations in a Model.
A have a DB for example that is 1:m and have the following structure:
| Id | Foreign Key | Date |
|:-----------|------------:|:------------:|
| 1 | 1 | 20-11-2019 |
| 2 | 1 | None |
The custom validation grants that for the same Foreign Key, there is only one row where date = None
As save() is not called in this method, @transaction.atomic would not work, hence, what is the best way to grant atomicity with this method?
I'm using python 3.7, django 2.2.6 and Postgresql