About Secure Model Methods
For model methods that modify data, set attribute alters_data = True
, so that the method can't be called from a template:
def enable(self):
self.is_enabled = True
self.save()
enable.alters_data = True
Tips and Tricks Programming Security Django 4.2 Django 3.2 Django 2.2
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.