Oh, I also tried using __setattr__ and __getattribute__ to solve this,
but the problem is that Django's ORM will just (unintentionally) call
__getattribute__ when generating the SQL, thereby unpickling the
object again, which will of course raise a SQL error and defeat the
entire purpose.

To see what I mean, try doing something like what I had at 
http://dpaste.com/27956/

On Dec 13, 8:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Heh, I just picked this up, too! I got the field working almost
> straight away after your kind help (all apart from queries, which I
> haven't fixed yet as I've been traveling up until this evening)
>
> Anyway, what I have ishttp://dpaste.com/27955/which seems to work
> fine, all apart from the issue I detail 
> inhttp://groups.google.com/group/django-users/browse_frm/thread/dc8aaf4...
>
> Hope this helps, let me know how you get on. As soon as I get queries
> working, I will post the full code to Django Snippets.
>
> Happy Djangoing!
>
> On Dec 13, 6:48 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
>
> > Ken,
>
> > There was someone else working on this recently as well, so you might
> > take a look at the conversation,[1] the beginnings of the code,[2] and
> > probably contact the author directly to see if you two can't share
> > ideas. It'd be a shame to duplicate effort. It'd be a great candidate
> > for a snippet.[3]
>
> > -Gul
>
> > [1]http://groups.google.com/group/django-users/browse_thread/thread/988d...
> > [2]http://dpaste.com/hold/27712/
> > [3]http://www.djangosnippets.org/
>
> > On Dec 13, 2007 12:59 PM, Ken <[EMAIL PROTECTED]> wrote:
>
> > > Does anyone have an example on how to sub-class a model field so that
> > > setattr pickles the field and getattr unpickles it?  I want to shuffle
> > > a query back and forth between the app and the rendered pages.  I
> > > could urlencode the query but the URL could get potentially rather
> > > long so I thought I'd shuffle just a key to an entry in a table.  The
> > > value part of the entry would be the pickled dict for the query.
>
> > >http://mydjangoapps.mydomain/appname/?srchid=23
>
> > > instead of
>
> > >http://mydjangoapps.mydomain/appname/?this=xxx&that=yyy∧=so&on=and
> > > ...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to