Skip to content

Instantly share code, notes, and snippets.

@kyleterry
Created September 9, 2011 23:25
Show Gist options
  • Save kyleterry/1207593 to your computer and use it in GitHub Desktop.
Save kyleterry/1207593 to your computer and use it in GitHub Desktop.
In [12]: order = Order.objects.get(pk=1341114)
In [13]: order.snailtrack
Out[13]: <Snailtrack: orders_order #15: 1341114>
In [14]: st = order.snailtrack
In [15]: st.actions
Out[15]: [<Action: update #39 at 2011-09-09 16:18:01.900710>, <Action: insert #36 at 2011-09-09 16:17:19.944937>, <Action: insert #35 at 2011-09-09 16:17:19.933299>]
In [16]: st.children.all()
Out[16]: [<Snailtrack: orders_orderline #16: 18629586>, <Snailtrack: orders_orderline #17: 18629588>]
In [18]: for child in st.children.all():
....: child.actions
....:
....:
Out[18]: [<Action: update #48 at 2011-09-09 16:18:56.441650>, <Action: update #45 at 2011-09-09 16:18:52.571655>, <Action: update #42 at 2011-09-09 16:18:06.424892>, <Action: update #41 at 2011-09-09 16:18:06.355493>, <Action: update #40 at 2011-09-09 16:18:02.013808>, <Action: insert #38 at 2011-09-09 16:18:01.824297>, <Action: insert #37 at 2011-09-09 16:18:01.815825>]
Out[18]: [<Action: update #49 at 2011-09-09 16:18:56.475246>, <Action: update #47 at 2011-09-09 16:18:56.329588>, <Action: update #46 at 2011-09-09 16:18:52.591884>, <Action: insert #44 at 2011-09-09 16:18:52.410585>, <Action: insert #43 at 2011-09-09 16:18:52.411513>]
In [20]: order.snailtrack.story()
Out[20]:
[u'W1341114 was updated on 2011-09-09 16:18:01.847268',
u' was created on 2011-09-09 16:17:19.891855',
u' was created on 2011-09-09 16:17:19.891855',
u'W1341114 was updated on 2011-09-09 16:18:01.847268',
u' was created on 2011-09-09 16:17:19.891855',
u' was created on 2011-09-09 16:17:19.891855',
u'W1341114 was updated on 2011-09-09 16:18:01.847268',
u' was created on 2011-09-09 16:17:19.891855',
u' was created on 2011-09-09 16:17:19.891855']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment