I'm trying to implement a simple "checkpointing" system to save partially completed formsets. I've got a set of large forms (say 100 entries) for a data-entry project. Now, if the person quits or whatever, halfway through, then I'd like this progress saved - but I don't want the half-entered data saved in the database until it's complete.
As far as I can see the best way to deal with this is to save request.POST
to a database field and pull it out again e.g.
def myview(request, obj_id):
obj = get_object_or_404(Task, obj_id)
if request.POST:
# save checkpoint
obj.checkpoint = serializers.serialize("json", request.POST)
else:
# load last version from database.
request.POST = serializers.deserialize("json", obj.checkpoint)
formset = MyFormSet(request.POST)
# etc.
But, this gives me the following error:
'unicode' object has no attribute '_meta'
I've tried simple json and pickle and get the same errors. Is there any way around this?