mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user