krishraghuram / mess

Mess Feedback System using RFID, Raspberry Pi and Django
GNU General Public License v2.0
0 stars 0 forks source link

Activity validate_ratingrange does not work as intended #21

Closed krishraghuram closed 6 years ago

krishraghuram commented 6 years ago

validate_ratingrange used in Activity does not work as expected.

It only validates in ModelForm, as stated in django docs.

Thus, anytime we create the Model object in python and save it, it does not validate the rating.

This needs to be fixed.

krishraghuram commented 6 years ago

I was wrong before

https://docs.djangoproject.com/en/2.0/ref/models/instances/#validating-objects

The validators are called by Model.full_clean(). But Model.save() does not call full_clean(). Thus, we have to call it wherever necessary.