feat: add related version tables for asset/log revision history
This commit is contained in:
parent
5046171b76
commit
7d5ff47e8e
2 changed files with 31 additions and 0 deletions
|
|
@ -296,6 +296,21 @@ class AssetMasterView(WuttaFarmMasterView):
|
|||
|
||||
return buttons
|
||||
|
||||
def get_version_joins(self):
|
||||
"""
|
||||
We override this to declare the relationship between the
|
||||
view's data model (which is some type of asset table) and the
|
||||
canonical ``Asset`` model, so the revision history views
|
||||
include transactions which reference either version table.
|
||||
|
||||
See also parent method,
|
||||
:meth:`~wuttaweb:wuttaweb.views.master.MasterView.get_version_joins()`
|
||||
"""
|
||||
model = self.app.model
|
||||
return super().get_version_joins() + [
|
||||
model.Asset,
|
||||
]
|
||||
|
||||
def get_row_grid_data(self, asset):
|
||||
model = self.app.model
|
||||
session = self.Session()
|
||||
|
|
|
|||
|
|
@ -344,6 +344,22 @@ class LogMasterView(WuttaFarmMasterView):
|
|||
|
||||
return buttons
|
||||
|
||||
def get_version_joins(self):
|
||||
"""
|
||||
We override this to declare the relationship between the
|
||||
view's data model (which is some type of log table) and the
|
||||
canonical ``Log`` model, so the revision history views include
|
||||
transactions which reference either version table.
|
||||
|
||||
See also parent method,
|
||||
:meth:`~wuttaweb:wuttaweb.views.master.MasterView.get_version_joins()`
|
||||
"""
|
||||
model = self.app.model
|
||||
return super().get_version_joins() + [
|
||||
model.Log,
|
||||
(model.LogAsset, "log_uuid", "uuid"),
|
||||
]
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
base = globals()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue