diff --git a/RIGS/templates/RIGS/activity_stream.html b/RIGS/templates/RIGS/activity_stream.html
index 38794db6..80bf1381 100644
--- a/RIGS/templates/RIGS/activity_stream.html
+++ b/RIGS/templates/RIGS/activity_stream.html
@@ -71,7 +71,7 @@
{{ version.revision.user.name }} |
{% if version.old == None %}
- Event Created
+ Object Created
{% else %}
{% include 'RIGS/version_changes.html' %}
{% endif %} |
@@ -108,7 +108,7 @@
{% else %}
changed {% include 'RIGS/version_changes.html' %} in
{% endif %}
- {% include 'RIGS/event_button.html' with event=version.current %}
+ {% include 'RIGS/object_button.html' with object=version.current %}
{% endif %}
diff --git a/RIGS/templates/RIGS/event_button.html b/RIGS/templates/RIGS/event_button.html
deleted file mode 100644
index 9309ce2f..00000000
--- a/RIGS/templates/RIGS/event_button.html
+++ /dev/null
@@ -1,18 +0,0 @@
-{# pass in variable "event" to this template #}
-
-
\ No newline at end of file
diff --git a/RIGS/templates/RIGS/event_version_list.html b/RIGS/templates/RIGS/event_version_list.html
deleted file mode 100644
index eb53d4d8..00000000
--- a/RIGS/templates/RIGS/event_version_list.html
+++ /dev/null
@@ -1,52 +0,0 @@
-{% extends request.is_ajax|yesno:"base_ajax.html,base.html" %}
-{% load static %}
-
-{% block title %}N{{ object.pk|stringformat:"05d" }} - Revision History{% endblock %}
-
-{% block js %}
-
-
-
-{% endblock %}
-
-{% block content %}
-N{{ object.pk|stringformat:"05d" }} - Revision History
-
-
-
-
- | Version ID |
- Date |
- User |
- Changes |
-
-
-
- {% for version in object_list %}
- {% if version.item_changes or version.field_changes or version.old == None %}
-
- | {{ version.version.pk }}|{{ version.revision.pk }} |
- {{ version.revision.date_created|date:"RIGS_DATETIME_FORMAT" }} |
- {{ version.revision.user.name }} |
-
- {% if version.old == None %}
- Event Created
- {% else %}
- {% include 'RIGS/version_changes.html' %}
- {% endif %}
- |
-
- {% endif %}
- {% endfor %}
-
-
-
-{% endblock %}
\ No newline at end of file
diff --git a/RIGS/templates/RIGS/object_button.html b/RIGS/templates/RIGS/object_button.html
new file mode 100644
index 00000000..9b5d838c
--- /dev/null
+++ b/RIGS/templates/RIGS/object_button.html
@@ -0,0 +1,4 @@
+{% load to_class_name from filters %}
+{# pass in variable "object" to this template #}
+
+{{object|to_class_name}} {{ object.pk|stringformat:"05d" }}
\ No newline at end of file
diff --git a/RIGS/templates/RIGS/version_history.html b/RIGS/templates/RIGS/version_history.html
new file mode 100644
index 00000000..1cc3f8cf
--- /dev/null
+++ b/RIGS/templates/RIGS/version_history.html
@@ -0,0 +1,63 @@
+{% extends request.is_ajax|yesno:"base_ajax.html,base.html" %}
+{% load to_class_name from filters %}
+{% load paginator from filters %}
+{% load static %}
+
+{% block title %}{{object|to_class_name}} {{ object.pk|stringformat:"05d" }} - Revision History{% endblock %}
+
+{% block js %}
+
+
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+ | Date |
+ Version ID |
+ User |
+ Changes |
+
+
+
+ {% for version in object_list %}
+ {% if version.item_changes or version.field_changes or version.old == None %}
+
+ | {{ version.revision.date_created|date:"RIGS_DATETIME_FORMAT" }} |
+ {{ version.version.pk }}|{{ version.revision.pk }} |
+ {{ version.revision.user.name }} |
+
+ {% if version.old == None %}
+ Object Created
+ {% else %}
+ {% include 'RIGS/version_changes.html' %}
+ {% endif %}
+ |
+
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
{% paginator %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/RIGS/urls.py b/RIGS/urls.py
index 1ff59e5e..bc2dcef5 100644
--- a/RIGS/urls.py
+++ b/RIGS/urls.py
@@ -1,6 +1,6 @@
from django.conf.urls import patterns, include, url
from django.contrib.auth.decorators import login_required
-from RIGS import views, rigboard, finance, ical, versioning, forms
+from RIGS import models, views, rigboard, finance, ical, versioning, forms
from django.views.generic import RedirectView
from PyRIGS.decorators import permission_required_with_403
@@ -25,6 +25,9 @@ urlpatterns = patterns('',
url(r'^people/(?P\d+)/$',
permission_required_with_403('RIGS.view_person')(views.PersonDetail.as_view()),
name='person_detail'),
+ url(r'^people/(?P\d+)/history/$',
+ permission_required_with_403('RIGS.view_person')(versioning.VersionHistory.as_view()),
+ name='person_history', kwargs={'model': models.Person}),
url(r'^people/(?P\d+)/edit/$',
permission_required_with_403('RIGS.change_person')(views.PersonUpdate.as_view()),
name='person_update'),
@@ -81,8 +84,8 @@ urlpatterns = patterns('',
name='event_archive'),
url(r'^event/(?P\d+)/history/$',
- permission_required_with_403('RIGS.view_event')(versioning.EventRevisions.as_view()),
- name='event_history'),
+ permission_required_with_403('RIGS.view_event')(versioning.VersionHistory.as_view()),
+ name='event_history', kwargs={'model': models.Event}),
url(r'^rigboard/activity$',
permission_required_with_403('RIGS.view_event')(versioning.ActivityStream.as_view()),
diff --git a/RIGS/versioning.py b/RIGS/versioning.py
index 0b55698b..eb5e80bc 100644
--- a/RIGS/versioning.py
+++ b/RIGS/versioning.py
@@ -139,14 +139,29 @@ def get_changes_for_version(newVersion, oldVersion=None):
return compare
-class EventRevisions(generic.TemplateView):
+class VersionHistory(generic.ListView):
model = reversion.revisions.Version
- template_name = "RIGS/event_version_list.html"
-
+ template_name = "RIGS/version_history.html"
+ paginate_by = 25
+
+ def get_queryset(self, **kwargs):
+ thisModel = self.kwargs['model']
+
+ # thisObject = get_object_or_404(thisModel, pk=self.kwargs['pk'])
+ versions = reversion.get_for_object_reference(thisModel, self.kwargs['pk'])
+
+ return versions
+
def get_context_data(self, **kwargs):
- thisEvent = get_object_or_404(models.Event, pk=self.kwargs['pk'])
- versions = reversion.get_for_object(thisEvent)
+ thisModel = self.kwargs['model']
+
+ context = super(VersionHistory, self).get_context_data(**kwargs)
+
+ versions = context['object_list']
+ thisObject = get_object_or_404(thisModel, pk=self.kwargs['pk'])
+
items = []
+
for versionNo, thisVersion in enumerate(versions):
if versionNo >= len(versions)-1:
thisItem = get_changes_for_version(thisVersion, None)
@@ -155,11 +170,9 @@ class EventRevisions(generic.TemplateView):
items.append(thisItem)
- context = {
- 'object_list': items,
- 'object': thisEvent
- }
-
+ context['object_list'] = items
+ context['object'] = thisObject
+
return context
class ActivityStream(generic.ListView):