diff --git a/RIGS/rigboard.py b/RIGS/rigboard.py
index 23371b2f..dba6b13c 100644
--- a/RIGS/rigboard.py
+++ b/RIGS/rigboard.py
@@ -214,10 +214,10 @@ class EventRevisions(generic.ListView):
thisEvent = get_object_or_404(models.Event, pk=self.kwargs['pk'])
- revisions = reversion.get_for_object(thisEvent)
+ revisions = reversion.get_unique_for_object(thisEvent)
items = []
for revisionNo, thisRevision in enumerate(revisions):
- thisItem = {}
+ thisItem = {'pk': thisRevision.pk}
thisItem['revision'] = thisRevision.revision
logger.info(thisRevision.revision.version_set.all())
if revisionNo >= len(revisions)-1:
@@ -233,14 +233,32 @@ class EventRevisions(generic.ListView):
return context
-class EventRevision(generic.DetailView):
+class EventRevision(generic.TemplateView):
model = reversion.revisions.Revision
- template_name = "RIGS/event_revision.html"
+ template_name = "RIGS/event_detail.html"
- def get_queryset(self):
- pk=self.kwargs['pk']
- thisVersion = get_object_or_404(reversion.models.Revision, pk=self.kwargs['pk'])
- #items = reversion.revisions.Version
- #thisVersion.
+ def get_context_data(self, pk, source, dest=None):
+ model = get_object_or_404(models.Event, pk=pk)
+ revisions = reversion.get_for_object(model)
+ source = revisions.get(pk=source)
- return self.model.objects.filter(pk=pk)
\ No newline at end of file
+ if dest:
+ dest = revisions.get(pk=dest)
+ else:
+ dest = reversion.get_for_date(model, datetime.datetime.today())
+
+ diff = {
+ 'pk': pk, # need this for the edit button to work
+ }
+ for field in source.field_dict:
+ html = generate_patch_html(source, dest, field, cleanup="semantic")
+ # tidy up
+ html = html.replace("¶", "")
+ diff[field] = html
+
+ context = {
+ 'object': diff,
+ 'event': diff
+ }
+
+ return context
\ No newline at end of file
diff --git a/RIGS/templates/RIGS/event_revision.html b/RIGS/templates/RIGS/event_revision.html
index e69de29b..b4c7a96f 100644
--- a/RIGS/templates/RIGS/event_revision.html
+++ b/RIGS/templates/RIGS/event_revision.html
@@ -0,0 +1,13 @@
+{% extends 'base.html' %}
+
+{% block title %}Versions{% endblock %}
+
+{% block content %}
+ {% for field, change in diff.items %}
+ {{ change }}
+ {% autoescape off %}
+ {{ change }}
+ {% endautoescape %}
+
+ {% endfor %}
+{% endblock %}
\ No newline at end of file
diff --git a/RIGS/templates/RIGS/revision_list.html b/RIGS/templates/RIGS/revision_list.html
index 7e5f5b1e..a84d711d 100644
--- a/RIGS/templates/RIGS/revision_list.html
+++ b/RIGS/templates/RIGS/revision_list.html
@@ -26,7 +26,7 @@