#12279: prepare_database_save in add_update_fields makes some custom fields be
impossible.
---------------------------------------------------+------------------------
Reporter: bear330 | Owner: nobody
Status: closed | Milestone:
Component: Database layer (models, ORM) | Version: 1.1
Resolution: wontfix | Keywords:
prepare_database_save, ObjectField, ClassField
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Changes (by russellm):
* status: new => closed
* resolution: => wontfix
Comment:
I'm going to mark this wontfix. I can see that you're having a problem,
but you're in a corner case that is in direct conflict with something
Django needs to do. Some difficulty is to be expected.
Django uses duck typing in a number of places in the query compilation
system. Methods like as_sql, get_placeholder, and prepare_database_save
are used to determine how to prepare a value for use in a query. This is
how we are able to support GIS data types.
My suggestion to you would be to introduce a wrapper class. Just as GIS
types are a wrapper for a blob of GIS geometries, you should be able to
write a wrapper that can hold objects or classes. Override the __set__ and
__get__ method on field to apply and remove these wrappers.
Yes, it will take some work, but like I said - you're in a corner case
here.
--
Ticket URL: <http://code.djangoproject.com/ticket/12279#comment:3>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.