#22492: provide a way to prevent database queries on model objects -------------------------------------+------------------------------------- Reporter: Chris Jerdonek | Owner: Raúl | Cumplido Type: New feature | Status: assigned Component: Database layer | Version: dev (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted model,queryset,defer,only | Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Andrea F): I want a feature that is similar to what was original described but for a different use case: I have a Celery task that needs a model object in the state it was when the task was enqueued, ''not'' in a state reflecting the corresponding database row(s) when the task is processed. I pass the object to the Celery task by serializing the entity (using `django.serializers`) and saving exactly the information I want to make available to the task. This object model has complex inner workings and multiple foreign keys. I want to be able to use the object model functionality and custom logic we have implemented in the model class, but I do _not_ want it reading (or writing) anything from the database after deserialization in the Celery task. For this I want something less "smart" than a feature that knows about `only` and `defer` and `QuerySet` objects. For this I want to be able to set a flag on an object that would disable any further database interactions originating from that object. -- Ticket URL: <https://code.djangoproject.com/ticket/22492#comment:10> 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/01070186145d3438-b3970cc6-dc39-43dc-b83d-f57113c05572-000000%40eu-central-1.amazonses.com.