gintas / django-picklefield

A pickled object field for Django
MIT License
180 stars 47 forks source link

Make sure objects such as `django.db.models.Model` subclasses can be pickled correctly and `callable` objects can be wrapped to be retreived using the ORM. #3

Closed charettes closed 12 years ago

charettes commented 12 years ago

Prior to this patch attempting to update a Model instance with a PickledObjectField referencing a django.db.Model subclass (or any object with the prepare_database_save) property raised a TypeError and there was no way to retreive a stored object that was callable since the ORM would try to filter on the actual return value of the object instead of the object instead (this is a desired and documented behavior to allow Model.objects.filter(datetime_field__gte=datetime.now) to work correctly and is especially usefull when defining limit_choices_to).