I am saving the form data into a model instance. There are fields where the user can enter values from 0 and above or leave them empty. Now I should assign them to a field.
Eg code
def update(self, my_val):
self.my_val = my_val or None
This above code works fine for values of 1 and above. But not for 0. How can I allow for 0 and positive numbers and if my_val is an empty string then I should store it as None. How can I do that?