On Mon, 2007-06-11 at 08:21 -0700, [EMAIL PROTECTED] wrote: > No worries. I updated the get_db_prep_save to > > def get_db_prep_save(self, value): > if not isinstance( value, basestring ): > return cPickle.dumps(value) > else: > return value > > So that it doesn't re-pickle data that is already a string. Then I > unpickle the field if it's a string when ever I use it. A little > clunky, but my project's getting done.
I was thinking about this a bit more. As a work around, you could also add an __init__ to your model. Normally, no __init__ method is needed, but if you did something like this: class MyModel(models.Model): def __init__(self, *args, **kwargs): super(MyModel, self).__init__(*args, **kwargs) self.pickled_field = cPickle.dumps(value) it might do the job without having to modify Django's core. You can just explicitly convert the field (or fields) to the value you want. It's not particularly neat as a general solution for field sub-classing, but for one or two fields with code that works right this minute, it could be worth trying. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---