I have a custom function in a form that I would like to reuse. Hence I pushed it into the model so that the form can still access it and I could access it from elsewhere as well.
Now on my demo page upon instantiation of that model, I need access to that function round_time_to_nearest_quarter(). But the instance hasn’t been created yet, hence how do I access the function? It is a chicken and egg situation:
event = c3.event_set.create(
due_date_time = (???) round_time_to_nearest_quarter() + timezone.timedelta(days=1, hours=3),
)
Is there a better strategy to do this?
If you have some function, which is not dependent on any model, put this method to your utils.py file.