def save(self, form):
     # store, regardless of validity
     form.seen()
     data = form.data or {}
     data = strip_csrftoken(data)
     setattr(self.object, self.datafield, serialize(data))
     self.object.save()
 def load_data(self):
     data = MultiValueDict()
     # load old data
     old_data = unserialize(getattr(self.object, self.datafield))
     data.update(old_data)
     # overwrite with fresh data
     data = update_multivaluedict(data, self.request.POST)
     qdata = QueryDict('', mutable=True)
     qdata.update(data)
     data = strip_csrftoken(qdata)
     if not data:
         data = None
     return data
 def strip_csrftoken(self, data):
     # For backwards compatibility
     return strip_csrftoken(data)