Open
Description
Hi, I'm trying to store a record history on an hstore field, however every time I retrieve the field and save to it, things start getting over escaped.
My custom models.Manager defer's the retrieval of history
field (of type hstore) so every time there's an update I retrieve the field in the following manner
objHistory = self.__class__.objects.values_list('history', flat=True).get(pk=self.pk)
after that, I update the history and store it.
history_update = str(userId) + ":update:" + key + ":" + str(getattr(self, key))
self.history['%s' % now()] = history_update
super(EspBase, self).save(*args, **kwargs)
even after the first save, the key is stored fine but the string is already over escaped
"2017-01-13 05:01:39.684107+00:00" => "\":update:product:lol2 /3\""
Here's a sample run of what happens after a few save calls
>>> eci.save()
None
>>> eci.product = prod2
>>> eci.save()
{}
>>> eci.product = prod
>>> eci.save()
{u'2017-01-13 04:57:10.932450+00:00': u'":update:product:lol2 /3"'}
>>> eci.product = prod2
>>> eci.save()
{u'2017-01-13 04:57:10.932450+00:00': u'"\\":update:product:lol2 /3\\""', u'2017-01-13 04:57:10.937826+00:00': u'":update:product:lol /2"'}
>>> eci.product = prod
>>> eci.save()
{u'2017-01-13 04:57:10.943229+00:00': u'":update:product:lol2 /3"', u'2017-01-13 04:57:10.932450+00:00': u'"\\"\\\\\\":update:product:lol2 /3\\\\\\"\\""', u'2017-01-13 04:57:10.937826+00:00': u'"\\":update:product:lol /2\\""'}
any idea on what could be causing this over escaping?
Metadata
Metadata
Assignees
Labels
No labels