Created
August 13, 2014 08:00
-
-
Save etianen/429326a877144387139d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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