diff --git a/RIGS/models.py b/RIGS/models.py
index 58b18a1c..824cb341 100644
--- a/RIGS/models.py
+++ b/RIGS/models.py
@@ -608,3 +608,6 @@ class RiskAssessment(models.Model):
suspended_structures = models.BooleanField(default=False, help_text="Are any structures (excluding projector screens and IWBs) being suspended from TEC's structures?")
# Blimey that was a lot of options
+
+ def __str__(self):
+ return "%i: %s" % (self.pk, self.event)
diff --git a/RIGS/templates/object_button.html b/RIGS/templates/object_button.html
deleted file mode 100644
index be907795..00000000
--- a/RIGS/templates/object_button.html
+++ /dev/null
@@ -1,4 +0,0 @@
-{% load to_class_name from filters %}
-{# pass in variable "object" to this template #}
-
-{% if object.is_rig == False %}Non-rig{% elif object.dry_hire %}Dry Hire{% elif object.is_rig %}Rig{%else%}{{object|to_class_name}}{% endif %} | '{{ object.activity_feed_string|default:object.name }}'
\ No newline at end of file
diff --git a/RIGS/templates/partials/event_status.html b/RIGS/templates/partials/event_status.html
index f2265b1a..78abdd4e 100644
--- a/RIGS/templates/partials/event_status.html
+++ b/RIGS/templates/partials/event_status.html
@@ -9,7 +9,7 @@
{% endif %}
- {% if event.risk_assessment_edit_url %}
+ {% if event.riskassessment %}
RA:
{% else %}
RA:
diff --git a/versioning/templates/object_button.html b/versioning/templates/object_button.html
new file mode 100644
index 00000000..b62f68f0
--- /dev/null
+++ b/versioning/templates/object_button.html
@@ -0,0 +1,10 @@
+{% load to_class_name from filters %}
+{# pass in variable "object" to this template #}
+
+{% if object.name %}
+ {% if object.is_rig == False %}Non-rig{% elif object.dry_hire %}Dry Hire{% elif object.is_rig %}Rig{%else%}{{object|to_class_name}}{% endif %} | '{{ object.activity_feed_string|default:object.name }}'
+{% elif object.asset_id %}
+ Asset | {{object.asset_id }} {{object.description }}
+{% elif object.event %}
+ {{object|to_class_name}} | {{object.event.name }}
+{% endif %}
diff --git a/versioning/versioning.py b/versioning/versioning.py
index a7d569e3..76cbdba7 100644
--- a/versioning/versioning.py
+++ b/versioning/versioning.py
@@ -10,6 +10,7 @@ from django.utils.functional import cached_property
from django.views import generic
from reversion.models import Version, VersionQuerySet
from RIGS import models
+from assets import models as asset_models
logger = logging.getLogger('tec.pyrigs')
@@ -23,8 +24,6 @@ class FieldComparison(object):
def display_value(self, value):
if isinstance(self.field, IntegerField) and self.field.choices is not None and len(self.field.choices) > 0:
return [x[1] for x in self.field.choices if x[0] == value][0]
- if self.field.name == "risk_assessment_edit_url":
- return "completed" if value else ""
return value
@property
@@ -159,6 +158,7 @@ class ModelComparison(object):
class RIGSVersionManager(VersionQuerySet):
+ # TODO Rework this so its possible to define from the other apps
def get_for_multiple_models(self, model_array):
content_types = []
for model in model_array:
@@ -225,7 +225,7 @@ class ActivityTable(generic.ListView):
def get_queryset(self):
versions = RIGSVersion.objects.get_for_multiple_models(
- [models.Event, models.Venue, models.Person, models.Organisation, models.EventAuthorisation])
+ [models.Event, models.Venue, models.Person, models.Organisation, models.EventAuthorisation, models.RiskAssessment])
return versions.order_by("-revision__date_created")
def get_context_data(self, **kwargs):
@@ -235,6 +235,7 @@ class ActivityTable(generic.ListView):
return context
+# Appears on homepage
class ActivityFeed(generic.ListView):
model = RIGSVersion
template_name = "activity_feed_data.html"
@@ -242,7 +243,7 @@ class ActivityFeed(generic.ListView):
def get_queryset(self):
versions = RIGSVersion.objects.get_for_multiple_models(
- [models.Event, models.Venue, models.Person, models.Organisation, models.EventAuthorisation])
+ [models.Event, models.Venue, models.Person, models.Organisation, models.EventAuthorisation, models.RiskAssessment, asset_models.Asset, asset_models.Supplier])
return versions.order_by("-revision__date_created")
def get_context_data(self, **kwargs):