Thank you for this Tom, it's been awhile since I read about the
QuerySet API.
Kayode: I'm not sure you can export such data as a CSV. Why do you
need the date exported in this manner? You can export the exact data
from the database into a CSV, but re-importing would need a bit of
work. I have
On Fri, Sep 2, 2011 at 11:05 AM, Kevin wrote:
> An interesting question here, not sure if anybody has tried to pickle
> their QuerySets before.
>
Not only have people tried this before, but there is an entry in the
manual about it:
https://docs.djangoproject.com/en/1.3/ref/models/querysets/#pick
Thanks for this.
I have a question. Is it possible to pickle a QuerySet and write to csv?
I have been trying to use pickle to achieve the same stuff you just did. But
I guess I've not been patient enough.
Thanks
On Fri, Sep 2, 2011 at 11:17 AM, Kevin wrote:
> Wow! This is very interesting an
Wow! This is very interesting and I did not expect the results.
The following:
>>> dat = pickle.loads(open('kbase.dat','rb').read())
>>> for item in dat:
... item.save()
Worked flawlessly! It recreated all the data in the database that I
removed to see what would happen if I unpickled it and
An interesting question here, not sure if anybody has tried to pickle
their QuerySets before.
Here's an example that does work:
entry_list = Entry.objects.all()
response =
HttpResponse(pickle.dumps(entry_list),mimetype='application/x-
pickle.python')
response['Content-Dispo
5 matches
Mail list logo