About Model Methods and their Access in Templates

For all Django model methods that change the database entries anyhow, add an attribute alters_data = True. This ensures that the method cannot be called from a template. For example:

def calculate(self):
    # does some calculations and saves them
calculate.alters_data = True

Tips and Tricks Programming Django 5.x Django 4.2 Django 3.2