use middleware for revision
authorJacob Hilker <hilker.j@gmail.com>
Sun, 2 Feb 2014 00:35:03 +0000 (19:35 -0500)
committerJacob Hilker <hilker.j@gmail.com>
Sun, 2 Feb 2014 00:35:03 +0000 (19:35 -0500)
karmaworld/apps/courses/models.py
karmaworld/apps/courses/views.py
karmaworld/settings/common.py

index 78761a82b23b041cf1c56f43f5d9565138a609e8..86195539589c1b93b37b0f3976caa5f38dfd0636 100644 (file)
@@ -249,7 +249,6 @@ class Course(models.Model):
         """ return url based on school slug and self slug """
         return u"/{0}/{1}".format(self.school.slug, self.slug)
 
-    @reversion.create_revision()
     def save(self, *args, **kwargs):
         """ Save school and generate a slug if one doesn't exist """
         super(Course, self).save(*args, **kwargs) # generate a self.id
@@ -265,7 +264,6 @@ class Course(models.Model):
     def autocomplete_search_fields():
         return ("name__icontains",)
 
-    @reversion.create_revision()
     def update_note_count(self):
         """ Update self.file_count by summing the note_set """
         self.file_count = self.note_set.count()
index 0e91be50b187eddf74088bb5f75d3977e670632d..714047cecc1c1c07887c472334dce25485c79177 100644 (file)
@@ -4,7 +4,6 @@
 """ Views for the KarmaNotes Courses app """
 
 import json
-import reversion
 
 from django.core import serializers
 from django.core.exceptions import MultipleObjectsReturned
@@ -202,7 +201,6 @@ def flag_course(request, pk):
     """Record that somebody has flagged a note."""
     return ajax_increment(Course, request, pk, FLAG_FIELD, process_course_flag_events)
 
-@reversion.create_revision()
 def edit_course(request, pk):
     """
     Saves the edited course content
index af0271e92b25178f75d4060f0c35572836f3a8ae..06f03e1c8829c2290be5b85d57b4864bedc1e2f7 100644 (file)
@@ -177,6 +177,9 @@ MIDDLEWARE_CLASSES = (
     # Use GZip compression to reduce bandwidth.
     'django.middleware.gzip.GZipMiddleware',
 
+    # Version control middleware.
+    'reversion.middleware.RevisionMiddleware',
+
     # Default Django middleware.
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',