Skip to content

Instantly share code, notes, and snippets.

@etianen
Created August 13, 2014 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etianen/429326a877144387139d to your computer and use it in GitHub Desktop.
Save etianen/429326a877144387139d to your computer and use it in GitHub Desktop.
class Node(models.Model):
parent = models.ForeignKey("self", blank=True, null=True)
reversion.register(Node)
with reversion.create_revision():
p = Node.objects.create() # Version saved.
with reversion.create_revision():
c = Node.objects.create() # Version saved.
with reversion.create_revision():
c.parent = p
c.save() # Version saved.
with reversion.create_revision():
p.children.clear() # Version NOT saved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment