#27638: Rollback data changes made inside templates -------------------------------------+------------------------------------- Reporter: vinay karanam | Owner: nobody Type: | Status: new Cleanup/optimization | Component: Template system | Version: master Severity: Normal | Resolution: Keywords: | Triage Stage: | Someday/Maybe Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Simon Charette): Coupling the database layer with the template one looks like a really bad idea to me. What if you want to use the template layer without configuring a database? What if your template ends up taking a lot of time to render and keeps a transaction open the whole time? While the `alters_data` approach is not perfect I think that it offers a good enough solution paired with a convention of naming functions and methods appropriately. Now a small things that could be done to improve the situation could be to either automatically mark overridden `save()`/`delete()` methods as `alters_data = True` in `ModelBase.__new__` or have system checks to warn developers about this edge case. -- Ticket URL: <https://code.djangoproject.com/ticket/27638#comment:3> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/072.0951b7d85cd4ead4f09735e39f60f316%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.