Fix XML generation
This commit is contained in:
parent
9dd1954067
commit
185c1cf8a4
1 changed files with 5 additions and 5 deletions
|
@ -43,9 +43,9 @@ class HistoryEntry(models.Model):
|
||||||
def to_xml(self, xml_root):
|
def to_xml(self, xml_root):
|
||||||
entry = ET.Element('history')
|
entry = ET.Element('history')
|
||||||
entry_url = ET.Element('url')
|
entry_url = ET.Element('url')
|
||||||
entry_url.text = self.search
|
entry_url.text = str(self.search)
|
||||||
entry_ts = ET.Element('timestamp')
|
entry_ts = ET.Element('timestamp')
|
||||||
entry_ts.text = self.timestamp.timestamp()
|
entry_ts.text = str(self.timestamp.timestamp())
|
||||||
entry.append(entry_url)
|
entry.append(entry_url)
|
||||||
entry.append(entry_ts)
|
entry.append(entry_ts)
|
||||||
xml_root.append(entry)
|
xml_root.append(entry)
|
||||||
|
@ -125,9 +125,9 @@ class History(models.Model):
|
||||||
xml_root = ET.Element('root')
|
xml_root = ET.Element('root')
|
||||||
|
|
||||||
hist_node = ET.Element("history", attrib={
|
hist_node = ET.Element("history", attrib={
|
||||||
'start-ts': self.start_ts,
|
'start-ts': str(self.start_ts),
|
||||||
'played': 1 if self.played else 0,
|
'played': '1' if self.played else '0',
|
||||||
'user': self.user.pk,
|
'user': str(self.user.pk),
|
||||||
})
|
})
|
||||||
xml_root.append(hist_node)
|
xml_root.append(hist_node)
|
||||||
for entry in self.historyentry_set.all():
|
for entry in self.historyentry_set.all():
|
||||||
|
|
Loading…
Reference in a new issue