[snowy] Hook up reversion to the model
- From: Brad Taylor <btaylor src gnome org>
- To: svn-commits-list gnome org
- Subject: [snowy] Hook up reversion to the model
- Date: Thu, 14 May 2009 14:27:35 -0400 (EDT)
commit b0e15952108a7617cf510a876bbb2267af799c0d
Author: Brad Taylor <brad getcoded net>
Date: Thu May 14 14:27:24 2009 -0400
Hook up reversion to the model
---
notes/admin.py | 3 ++-
notes/models.py | 6 ++++++
settings.py | 1 +
3 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/notes/admin.py b/notes/admin.py
index 2ae8f99..d2df5ce 100644
--- a/notes/admin.py
+++ b/notes/admin.py
@@ -16,9 +16,10 @@
#
from django.contrib import admin
+from reversion.admin import VersionAdmin
from snowy.notes.models import Note
-class NoteAdmin(admin.ModelAdmin):
+class NoteAdmin(VersionAdmin):
list_display = ('created', 'author', 'title')
search_fields = ['body', 'title']
diff --git a/notes/models.py b/notes/models.py
index 48ad726..1a595cb 100644
--- a/notes/models.py
+++ b/notes/models.py
@@ -54,6 +54,7 @@ class Note(models.Model):
'note_id': self.id, 'username': self.author.username,
})
+
class NoteTag(models.Model):
author = models.ForeignKey(User)
name = models.CharField(max_length=256)
@@ -69,3 +70,8 @@ class NoteTag(models.Model):
if self.is_notebook:
return self.name.split(':', 2)[-1]
return self.name
+
+
+class VersionMetadata(models.Model):
+ revision = models.ForeignKey('reversion.Revision')
+ version = models.IntegerField()
diff --git a/settings.py b/settings.py
index 4ab9d97..7424c0e 100644
--- a/settings.py
+++ b/settings.py
@@ -66,6 +66,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.csrf.middleware.CsrfResponseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'reversion.middleware.RevisionMiddleware',
)
ROOT_URLCONF = 'snowy.urls'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]