Remove old-style continuum version views
This commit is contained in:
parent
83751f7c9e
commit
66cc6cd39a
10 changed files with 11 additions and 357 deletions
|
@ -49,7 +49,6 @@ from webhelpers.html import tags
|
|||
from tailbone import forms, newgrids as grids
|
||||
from tailbone.db import Session
|
||||
from tailbone.views import MasterView, SearchableAlchemyGridView, AutocompleteView
|
||||
from tailbone.views.continuum import VersionView, version_defaults
|
||||
from tailbone.progress import SessionProgress
|
||||
|
||||
|
||||
|
@ -539,37 +538,6 @@ class ProductsView(MasterView):
|
|||
config.add_view(cls, attr='image', route_name='products.image')
|
||||
|
||||
|
||||
class ProductVersionView(VersionView):
|
||||
"""
|
||||
View which shows version history for a product.
|
||||
"""
|
||||
parent_class = model.Product
|
||||
route_model_view = 'product.read'
|
||||
child_classes = [
|
||||
(model.ProductCode, 'product_uuid'),
|
||||
(model.ProductCost, 'product_uuid'),
|
||||
(model.ProductPrice, 'product_uuid'),
|
||||
]
|
||||
|
||||
def warn_if_deleted(self):
|
||||
"""
|
||||
Maybe set flash warning if product is marked deleted.
|
||||
"""
|
||||
uuid = self.request.matchdict['uuid']
|
||||
product = Session.query(model.Product).get(uuid)
|
||||
assert product, "No product found for UUID: {}".format(repr(uuid))
|
||||
if product.deleted:
|
||||
self.request.session.flash("This product is marked as deleted.", 'error')
|
||||
|
||||
def list(self):
|
||||
self.warn_if_deleted()
|
||||
return super(ProductVersionView, self).list()
|
||||
|
||||
def details(self):
|
||||
self.warn_if_deleted()
|
||||
return super(ProductVersionView, self).details()
|
||||
|
||||
|
||||
class ProductsAutocomplete(AutocompleteView):
|
||||
"""
|
||||
Autocomplete view for products.
|
||||
|
@ -630,4 +598,3 @@ def includeme(config):
|
|||
renderer='json', permission='products.print_labels')
|
||||
|
||||
ProductsView.defaults(config)
|
||||
version_defaults(config, ProductVersionView, 'product')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue