Tweak versioning templates to allow ID overrides

Asset specific templates begone. Still need to bring back the ID formatting for the Rigboard.
This commit is contained in:
2020-04-06 14:59:10 +01:00
parent d216dd4c74
commit 176324ed79
11 changed files with 35 additions and 53 deletions

View File

@@ -30,5 +30,5 @@
<div class="col-md-12">
{% include 'partials/asset_buttons.html' %}
</div>
{% include 'partials/last_edited_asset.html' with target="asset_history" %}
{% include 'partials/last_edited.html' with target="asset_history" id=object.asset_id %}
{% endblock %}

View File

@@ -233,18 +233,33 @@ class SupplierVersionHistory(versioning.VersionHistory):
class AssetVersionHistory(versioning.VersionHistory):
template_name = "asset_version_history.html"
template_name = "version_history.html"
def get_object(self, **kwargs):
return get_object_or_404(models.Asset, asset_id=self.kwargs['pk'])
def get_context_data(self, **kwargs):
context = super(AssetVersionHistory, self).get_context_data(**kwargs)
context['object'] = self.get_object()
context['id'] = self.get_object().asset_id
context['override'] = 'base_assets.html'
return context
class ActivityTable(versioning.ActivityTable):
model = versioning.RIGSVersion
template_name = "asset_activity_table.html"
template_name = "activity_table.html"
paginate_by = 25
def get_queryset(self):
versions = versioning.RIGSVersion.objects.get_for_multiple_models(
[models.Asset, models.Supplier])
return versions
def get_context_data(self, **kwargs):
context = super(ActivityTable, self).get_context_data(**kwargs)
context['override'] = 'base_assets.html'
context['title'] = 'Asset Database'
return context