Skip to content

Instantly share code, notes, and snippets.

@etianen
Created March 5, 2010 16:15
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/322864 to your computer and use it in GitHub Desktop.
Save etianen/322864 to your computer and use it in GitHub Desktop.
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.sites.models import Site
>>> from reversion.models import Revision, Version
>>> from reversion import revision
>>> revision.register(Site)
>>> @revision.create_on_success
... def foo():
... Site.objects.create(domain="foo")
... Site.objects.create(domain="bar")
...
>>> Revision.objects.all().delete()
>>> Revision.objects.all()
[]
>>> foo()
>>> Revision.objects.all()
[<Revision: foo, bar>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment