diff --git a/tailbone/views/batch/vendorcatalog.py b/tailbone/views/batch/vendorcatalog.py index 945b3758..cc9374f1 100644 --- a/tailbone/views/batch/vendorcatalog.py +++ b/tailbone/views/batch/vendorcatalog.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -45,7 +45,7 @@ from tailbone.views.batch import FileBatchMasterView log = logging.getLogger(__name__) -class VendorCatalogsView(FileBatchMasterView): +class VendorCatalogView(FileBatchMasterView): """ Master view for vendor catalog batches. """ @@ -132,7 +132,7 @@ class VendorCatalogsView(FileBatchMasterView): return self.parsers def configure_grid(self, g): - super(VendorCatalogsView, self).configure_grid(g) + super(VendorCatalogView, self).configure_grid(g) g.joiners['vendor'] = lambda q: q.join(model.Vendor) g.filters['vendor'] = g.make_filter('vendor', model.Vendor.name, default_active=True, default_verb='contains') @@ -145,7 +145,7 @@ class VendorCatalogsView(FileBatchMasterView): return six.text_type(batch.vendor) def configure_form(self, f): - super(VendorCatalogsView, self).configure_form(f) + super(VendorCatalogView, self).configure_form(f) # vendor f.set_renderer('vendor', self.render_vendor) @@ -187,7 +187,7 @@ class VendorCatalogsView(FileBatchMasterView): f.set_readonly('effective') def get_batch_kwargs(self, batch): - kwargs = super(VendorCatalogsView, self).get_batch_kwargs(batch) + kwargs = super(VendorCatalogView, self).get_batch_kwargs(batch) kwargs['parser_key'] = batch.parser_key if batch.vendor: kwargs['vendor'] = batch.vendor @@ -197,7 +197,7 @@ class VendorCatalogsView(FileBatchMasterView): return kwargs def configure_row_grid(self, g): - super(VendorCatalogsView, self).configure_row_grid(g) + super(VendorCatalogView, self).configure_row_grid(g) batch = self.get_instance() # starts @@ -230,7 +230,7 @@ class VendorCatalogsView(FileBatchMasterView): return 'notice' def configure_row_form(self, f): - super(VendorCatalogsView, self).configure_row_form(f) + super(VendorCatalogView, self).configure_row_form(f) f.set_renderer('product', self.render_product) f.set_type('discount_percent', 'percent') @@ -251,6 +251,9 @@ class VendorCatalogsView(FileBatchMasterView): kwargs['parsers'] = parsers return kwargs +# TODO: deprecate / remove this +VendorCatalogsView = VendorCatalogView + def includeme(config): - VendorCatalogsView.defaults(config) + VendorCatalogView.defaults(config) diff --git a/tailbone/views/batch/vendorinvoice.py b/tailbone/views/batch/vendorinvoice.py index a6777504..c16a7a6a 100644 --- a/tailbone/views/batch/vendorinvoice.py +++ b/tailbone/views/batch/vendorinvoice.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -38,7 +38,7 @@ from deform import widget as dfwidget from tailbone.views.batch import FileBatchMasterView -class VendorInvoicesView(FileBatchMasterView): +class VendorInvoiceView(FileBatchMasterView): """ Master view for vendor invoice batches. """ @@ -91,7 +91,7 @@ class VendorInvoicesView(FileBatchMasterView): return six.text_type(batch.vendor) def configure_grid(self, g): - super(VendorInvoicesView, self).configure_grid(g) + super(VendorInvoiceView, self).configure_grid(g) # vendor g.set_joiner('vendor', lambda q: q.join(model.Vendor)) @@ -117,7 +117,7 @@ class VendorInvoicesView(FileBatchMasterView): g.set_link('executed', False) def configure_form(self, f): - super(VendorInvoicesView, self).configure_form(f) + super(VendorInvoiceView, self).configure_form(f) # vendor if self.creating: @@ -166,7 +166,7 @@ class VendorInvoicesView(FileBatchMasterView): # raise formalchemy.ValidationError(unicode(error)) def get_batch_kwargs(self, batch): - kwargs = super(VendorInvoicesView, self).get_batch_kwargs(batch) + kwargs = super(VendorInvoiceView, self).get_batch_kwargs(batch) kwargs['parser_key'] = batch.parser_key return kwargs @@ -180,7 +180,7 @@ class VendorInvoicesView(FileBatchMasterView): return True def configure_row_grid(self, g): - super(VendorInvoicesView, self).configure_row_grid(g) + super(VendorInvoiceView, self).configure_row_grid(g) g.set_label('upc', "UPC") g.set_label('brand_name', "Brand") g.set_label('shipped_cases', "Cases") @@ -197,6 +197,9 @@ class VendorInvoicesView(FileBatchMasterView): row.STATUS_UNIT_COST_DIFFERS): return 'notice' +# TODO: deprecate / remove this +VendorInvoicesView = VendorInvoiceView + def includeme(config): - VendorInvoicesView.defaults(config) + VendorInvoiceView.defaults(config) diff --git a/tailbone/views/bouncer.py b/tailbone/views/bouncer.py index ac995aca..314f0eb6 100644 --- a/tailbone/views/bouncer.py +++ b/tailbone/views/bouncer.py @@ -41,7 +41,7 @@ from webhelpers2.html import HTML, tags from tailbone.views import MasterView -class EmailBouncesView(MasterView): +class EmailBounceView(MasterView): """ Master view for email bounces. """ @@ -66,14 +66,14 @@ class EmailBouncesView(MasterView): ] def __init__(self, request): - super(EmailBouncesView, self).__init__(request) + super(EmailBounceView, self).__init__(request) self.handler_options = sorted(get_profile_keys(self.rattail_config)) def get_handler(self, bounce): return get_handler(self.rattail_config, bounce.config_key) def configure_grid(self, g): - super(EmailBouncesView, self).configure_grid(g) + super(EmailBounceView, self).configure_grid(g) g.filters['config_key'].set_choices(self.handler_options) g.filters['config_key'].default_active = True @@ -93,7 +93,7 @@ class EmailBouncesView(MasterView): g.set_link('intended_recipient_address') def configure_form(self, f): - super(EmailBouncesView, self).configure_form(f) + super(EmailBounceView, self).configure_form(f) bounce = f.model_instance f.set_renderer('message', self.render_message_file) f.set_renderer('links', self.render_links) @@ -207,6 +207,9 @@ class EmailBouncesView(MasterView): cls._defaults(config) +# TODO: deprecate / remove this +EmailBouncesView = EmailBounceView + def includeme(config): - EmailBouncesView.defaults(config) + EmailBounceView.defaults(config) diff --git a/tailbone/views/brands.py b/tailbone/views/brands.py index b66c3f42..69b74a82 100644 --- a/tailbone/views/brands.py +++ b/tailbone/views/brands.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -31,7 +31,7 @@ from rattail.db import model from tailbone.views import MasterView, AutocompleteView -class BrandsView(MasterView): +class BrandView(MasterView): """ Master view for the Brand class. """ @@ -59,7 +59,7 @@ class BrandsView(MasterView): ] def configure_grid(self, g): - super(BrandsView, self).configure_grid(g) + super(BrandView, self).configure_grid(g) # name g.filters['name'].default_active = True @@ -90,6 +90,9 @@ class BrandsView(MasterView): self.Session.flush() self.Session.delete(removing) +# TODO: deprecate / remove this +BrandsView = BrandView + class BrandsAutocomplete(AutocompleteView): @@ -104,4 +107,4 @@ def includeme(config): config.add_view(BrandsAutocomplete, route_name='brands.autocomplete', renderer='json', permission='brands.list') - BrandsView.defaults(config) + BrandView.defaults(config) diff --git a/tailbone/views/categories.py b/tailbone/views/categories.py index 649ecfeb..229d60ef 100644 --- a/tailbone/views/categories.py +++ b/tailbone/views/categories.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -32,7 +32,7 @@ from tailbone import forms from tailbone.views import MasterView -class CategoriesView(MasterView): +class CategoryView(MasterView): """ Master view for the Category class. """ @@ -55,7 +55,7 @@ class CategoriesView(MasterView): ] def configure_grid(self, g): - super(CategoriesView, self).configure_grid(g) + super(CategoryView, self).configure_grid(g) g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' @@ -68,7 +68,7 @@ class CategoriesView(MasterView): g.set_link('name') def get_xlsx_fields(self): - fields = super(CategoriesView, self).get_xlsx_fields() + fields = super(CategoryView, self).get_xlsx_fields() fields.extend([ 'department_number', 'department_name', @@ -76,7 +76,7 @@ class CategoriesView(MasterView): return fields def get_xlsx_row(self, category, fields): - row = super(CategoriesView, self).get_xlsx_row(category, fields) + row = super(CategoryView, self).get_xlsx_row(category, fields) dept = category.department if dept: row['department_number'] = dept.number @@ -87,7 +87,7 @@ class CategoriesView(MasterView): return row def configure_form(self, f): - super(CategoriesView, self).configure_form(f) + super(CategoryView, self).configure_form(f) # department if self.creating or self.editing: @@ -106,6 +106,9 @@ class CategoriesView(MasterView): return [(dept.uuid, "{} {}".format(dept.number, dept.name)) for dept in departments] +# TODO: deprecate / remove this +CategoriesView = CategoryView + def includeme(config): - CategoriesView.defaults(config) + CategoryView.defaults(config) diff --git a/tailbone/views/customergroups.py b/tailbone/views/customergroups.py index 5c6892d5..02138346 100644 --- a/tailbone/views/customergroups.py +++ b/tailbone/views/customergroups.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -32,7 +32,7 @@ from tailbone.db import Session from tailbone.views import MasterView -class CustomerGroupsView(MasterView): +class CustomerGroupView(MasterView): """ Master view for the CustomerGroup class. """ @@ -54,7 +54,7 @@ class CustomerGroupsView(MasterView): ] def configure_grid(self, g): - super(CustomerGroupsView, self).configure_grid(g) + super(CustomerGroupView, self).configure_grid(g) g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' g.set_sort_defaults('name') @@ -76,6 +76,9 @@ class CustomerGroupsView(MasterView): cls._defaults(config) +# TODO: deprecate / remove this +CustomerGroupsView = CustomerGroupView + def includeme(config): - CustomerGroupsView.defaults(config) + CustomerGroupView.defaults(config) diff --git a/tailbone/views/customers.py b/tailbone/views/customers.py index a5cf963a..3d8e78d1 100644 --- a/tailbone/views/customers.py +++ b/tailbone/views/customers.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2020 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -43,7 +43,7 @@ from tailbone.views import MasterView, AutocompleteView from rattail.db import model -class CustomersView(MasterView): +class CustomerView(MasterView): """ Master view for the Customer class. """ @@ -110,7 +110,7 @@ class CustomersView(MasterView): ] def configure_grid(self, g): - super(CustomersView, self).configure_grid(g) + super(CustomerView, self).configure_grid(g) # name g.filters['name'].default_active = True @@ -160,7 +160,7 @@ class CustomersView(MasterView): def get_instance(self): try: - instance = super(CustomersView, self).get_instance() + instance = super(CustomerView, self).get_instance() except HTTPNotFound: pass else: @@ -189,7 +189,7 @@ class CustomersView(MasterView): raise HTTPNotFound def configure_common_form(self, f): - super(CustomersView, self).configure_common_form(f) + super(CustomerView, self).configure_common_form(f) customer = f.model_instance permission_prefix = self.get_permission_prefix() @@ -252,7 +252,7 @@ class CustomersView(MasterView): f.set_readonly('groups') def configure_form(self, f): - super(CustomersView, self).configure_form(f) + super(CustomerView, self).configure_form(f) customer = f.model_instance permission_prefix = self.get_permission_prefix() @@ -406,6 +406,9 @@ class CustomersView(MasterView): config.add_view(cls, attr='detach_person', route_name='{}.detach_person'.format(route_prefix), permission='{}.detach_person'.format(permission_prefix)) +# TODO: deprecate / remove this +CustomersView = CustomerView + # # TODO: this is referenced by some custom apps, but should be moved?? # def unique_id(value, field): @@ -492,4 +495,4 @@ def includeme(config): config.add_view(customer_info, route_name='customer.info', renderer='json', permission='customers.view') - CustomersView.defaults(config) + CustomerView.defaults(config) diff --git a/tailbone/views/custorders/items.py b/tailbone/views/custorders/items.py index da56e7de..2fb19225 100644 --- a/tailbone/views/custorders/items.py +++ b/tailbone/views/custorders/items.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -40,7 +40,7 @@ from tailbone.views import MasterView from tailbone.util import raw_datetime -class CustomerOrderItemsView(MasterView): +class CustomerOrderItemView(MasterView): """ Master view for customer order items """ @@ -100,7 +100,7 @@ class CustomerOrderItemsView(MasterView): .joinedload(model.CustomerOrder.person)) def configure_grid(self, g): - super(CustomerOrderItemsView, self).configure_grid(g) + super(CustomerOrderItemView, self).configure_grid(g) g.set_joiner('person', lambda q: q.outerjoin(model.Person)) @@ -134,7 +134,7 @@ class CustomerOrderItemsView(MasterView): return raw_datetime(self.rattail_config, value) def configure_form(self, f): - super(CustomerOrderItemsView, self).configure_form(f) + super(CustomerOrderItemView, self).configure_form(f) # order f.set_renderer('order', self.render_order) @@ -176,12 +176,15 @@ class CustomerOrderItemsView(MasterView): model.CustomerOrderItemEvent.type_code) def configure_row_grid(self, g): - super(CustomerOrderItemsView, self).configure_row_grid(g) + super(CustomerOrderItemView, self).configure_row_grid(g) g.set_label('occurred', "When") g.set_label('type_code', "What") # TODO: enum renderer g.set_label('user', "Who") g.set_label('note', "Notes") +# TODO: deprecate / remove this +CustomerOrderItemsView = CustomerOrderItemView + def includeme(config): - CustomerOrderItemsView.defaults(config) + CustomerOrderItemView.defaults(config) diff --git a/tailbone/views/custorders/orders.py b/tailbone/views/custorders/orders.py index 68ae24c1..b51402cd 100644 --- a/tailbone/views/custorders/orders.py +++ b/tailbone/views/custorders/orders.py @@ -42,7 +42,7 @@ from tailbone.db import Session from tailbone.views import MasterView -class CustomerOrdersView(MasterView): +class CustomerOrderView(MasterView): """ Master view for customer orders """ @@ -74,7 +74,7 @@ class CustomerOrdersView(MasterView): .options(orm.joinedload(model.CustomerOrder.customer)) def configure_grid(self, g): - super(CustomerOrdersView, self).configure_grid(g) + super(CustomerOrderView, self).configure_grid(g) g.set_joiner('customer', lambda q: q.outerjoin(model.Customer)) g.set_joiner('person', lambda q: q.outerjoin(model.Person)) @@ -98,7 +98,7 @@ class CustomerOrdersView(MasterView): g.set_label('id', "ID") def configure_form(self, f): - super(CustomerOrdersView, self).configure_form(f) + super(CustomerOrderView, self).configure_form(f) # id f.set_readonly('id') @@ -476,6 +476,9 @@ class CustomerOrdersView(MasterView): return {'ok': True, 'next_url': next_url} +# TODO: deprecate / remove this +CustomerOrdersView = CustomerOrderView + def includeme(config): - CustomerOrdersView.defaults(config) + CustomerOrderView.defaults(config) diff --git a/tailbone/views/datasync.py b/tailbone/views/datasync.py index 309b3bc2..d3b9b3b8 100644 --- a/tailbone/views/datasync.py +++ b/tailbone/views/datasync.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2020 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -37,7 +37,7 @@ from tailbone.views import MasterView log = logging.getLogger(__name__) -class DataSyncChangesView(MasterView): +class DataSyncChangeView(MasterView): """ Master view for the DataSyncChange model. """ @@ -64,7 +64,7 @@ class DataSyncChangesView(MasterView): ] def configure_grid(self, g): - super(DataSyncChangesView, self).configure_grid(g) + super(DataSyncChangeView, self).configure_grid(g) # batch_sequence g.set_label('batch_sequence', "Batch Seq.") @@ -113,6 +113,9 @@ class DataSyncChangesView(MasterView): cls._defaults(config) +# TODO: deprecate / remove this +DataSyncChangesView = DataSyncChangeView + def includeme(config): - DataSyncChangesView.defaults(config) + DataSyncChangeView.defaults(config) diff --git a/tailbone/views/departments.py b/tailbone/views/departments.py index c1369543..cc793ede 100644 --- a/tailbone/views/departments.py +++ b/tailbone/views/departments.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2020 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -36,7 +36,7 @@ from tailbone import grids from tailbone.views import MasterView, AutocompleteView -class DepartmentsView(MasterView): +class DepartmentView(MasterView): """ Master view for the Department class. """ @@ -61,7 +61,7 @@ class DepartmentsView(MasterView): ] def configure_grid(self, g): - super(DepartmentsView, self).configure_grid(g) + super(DepartmentView, self).configure_grid(g) g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' g.set_sort_defaults('number') @@ -71,7 +71,7 @@ class DepartmentsView(MasterView): g.set_link('name') def configure_form(self, f): - super(DepartmentsView, self).configure_form(f) + super(DepartmentView, self).configure_form(f) f.remove_field('subdepartments') f.remove_field('employees') f.set_type('product', 'boolean') @@ -144,6 +144,9 @@ class DepartmentsView(MasterView): cls._defaults(config) +# TODO: deprecate / remove this +DepartmentsView = DepartmentView + class DepartmentsAutocomplete(AutocompleteView): @@ -158,4 +161,4 @@ def includeme(config): config.add_view(DepartmentsAutocomplete, route_name='departments.autocomplete', renderer='json', permission='departments.list') - DepartmentsView.defaults(config) + DepartmentView.defaults(config) diff --git a/tailbone/views/depositlinks.py b/tailbone/views/depositlinks.py index db28e3f6..42f83460 100644 --- a/tailbone/views/depositlinks.py +++ b/tailbone/views/depositlinks.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -31,7 +31,7 @@ from rattail.db import model from tailbone.views import MasterView -class DepositLinksView(MasterView): +class DepositLinkView(MasterView): """ Master view for deposit links. """ @@ -52,7 +52,7 @@ class DepositLinksView(MasterView): ] def configure_grid(self, g): - super(DepositLinksView, self).configure_grid(g) + super(DepositLinkView, self).configure_grid(g) g.filters['description'].default_active = True g.filters['description'].default_verb = 'contains' g.set_sort_defaults('code') @@ -60,6 +60,9 @@ class DepositLinksView(MasterView): g.set_link('code') g.set_link('description') +# TODO: deprecate / remove this +DepositLinksView = DepositLinkView + def includeme(config): - DepositLinksView.defaults(config) + DepositLinkView.defaults(config) diff --git a/tailbone/views/email.py b/tailbone/views/email.py index 1349d4cc..2201f8f3 100644 --- a/tailbone/views/email.py +++ b/tailbone/views/email.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2020 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -40,7 +40,7 @@ from tailbone.db import Session from tailbone.views import View, MasterView -class ProfilesView(MasterView): +class EmailSettingView(MasterView): """ Master view for email admin (settings/preview). """ @@ -76,7 +76,7 @@ class ProfilesView(MasterView): ] def __init__(self, request): - super(ProfilesView, self).__init__(request) + super(EmailSettingView, self).__init__(request) self.handler = self.get_handler() def get_handler(self): @@ -159,7 +159,7 @@ class ProfilesView(MasterView): return True def configure_form(self, f): - super(ProfilesView, self).configure_form(f) + super(EmailSettingView, self).configure_form(f) profile = f.model_instance['_email'] # key @@ -222,6 +222,9 @@ class ProfilesView(MasterView): kwargs['email'] = self.handler.get_email(key) return kwargs +# TODO: deprecate / remove this +ProfilesView = EmailSettingView + class RecipientsType(colander.String): """ @@ -396,6 +399,6 @@ class EmailAttemptView(MasterView): def includeme(config): - ProfilesView.defaults(config) + EmailSettingView.defaults(config) EmailPreview.defaults(config) EmailAttemptView.defaults(config) diff --git a/tailbone/views/employees.py b/tailbone/views/employees.py index d7cad068..ea430a94 100644 --- a/tailbone/views/employees.py +++ b/tailbone/views/employees.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -40,7 +40,7 @@ from tailbone.db import Session from tailbone.views import MasterView, AutocompleteView -class EmployeesView(MasterView): +class EmployeeView(MasterView): """ Master view for the Employee class. """ @@ -80,7 +80,7 @@ class EmployeesView(MasterView): ] def configure_grid(self, g): - super(EmployeesView, self).configure_grid(g) + super(EmployeeView, self).configure_grid(g) route_prefix = self.get_route_prefix() # phone @@ -181,7 +181,7 @@ class EmployeesView(MasterView): return not self.is_employee_protected(employee) def configure_form(self, f): - super(EmployeesView, self).configure_form(f) + super(EmployeeView, self).configure_form(f) employee = f.model_instance f.set_renderer('person', self.render_person) @@ -230,7 +230,7 @@ class EmployeesView(MasterView): def objectify(self, form, data=None): if data is None: data = form.validated - employee = super(EmployeesView, self).objectify(form, data) + employee = super(EmployeeView, self).objectify(form, data) self.update_stores(employee, data) self.update_departments(employee, data) return employee @@ -304,6 +304,9 @@ class EmployeesView(MasterView): (model.EmployeeDepartment, 'employee_uuid'), ] +# TODO: deprecate / remove this +EmployeesView = EmployeeView + class EmployeesAutocomplete(AutocompleteView): """ @@ -328,4 +331,4 @@ def includeme(config): config.add_view(EmployeesAutocomplete, route_name='employees.autocomplete', renderer='json', permission='employees.list') - EmployeesView.defaults(config) + EmployeeView.defaults(config) diff --git a/tailbone/views/families.py b/tailbone/views/families.py index 997255b3..7bbdc966 100644 --- a/tailbone/views/families.py +++ b/tailbone/views/families.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -31,7 +31,7 @@ from rattail.db import model from tailbone.views import MasterView -class FamiliesView(MasterView): +class FamilyView(MasterView): """ Master view for the Family class. """ @@ -52,11 +52,14 @@ class FamiliesView(MasterView): ] def configure_grid(self, g): - super(FamiliesView, self).configure_grid(g) + super(FamilyView, self).configure_grid(g) g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' g.set_sort_defaults('code') +# TODO: deprecate / remove this +FamiliesView = FamilyView + def includeme(config): - FamiliesView.defaults(config) + FamilyView.defaults(config) diff --git a/tailbone/views/inventory.py b/tailbone/views/inventory.py index 7e4ed33f..7cf5d8d0 100644 --- a/tailbone/views/inventory.py +++ b/tailbone/views/inventory.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -33,7 +33,7 @@ import colander from tailbone.views import MasterView -class InventoryAdjustmentReasonsView(MasterView): +class InventoryAdjustmentReasonView(MasterView): """ Master view for inventory adjustment reasons. """ @@ -48,11 +48,11 @@ class InventoryAdjustmentReasonsView(MasterView): ] def configure_grid(self, g): - super(InventoryAdjustmentReasonsView, self).configure_grid(g) + super(InventoryAdjustmentReasonView, self).configure_grid(g) g.set_sort_defaults('code') def configure_form(self, f): - super(InventoryAdjustmentReasonsView, self).configure_form(f) + super(InventoryAdjustmentReasonView, self).configure_form(f) # code f.set_validator('code', self.unique_code) @@ -66,6 +66,9 @@ class InventoryAdjustmentReasonsView(MasterView): if query.count(): raise colander.Invalid(node, "Code must be unique") +# TODO: deprecate / remove this +InventoryAdjustmentReasonsView = InventoryAdjustmentReasonView + def includeme(config): - InventoryAdjustmentReasonsView.defaults(config) + InventoryAdjustmentReasonView.defaults(config) diff --git a/tailbone/views/labels/profiles.py b/tailbone/views/labels/profiles.py index 3fb5dd34..3dfe07ab 100644 --- a/tailbone/views/labels/profiles.py +++ b/tailbone/views/labels/profiles.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -34,7 +34,7 @@ from tailbone import forms from tailbone.views import MasterView -class ProfilesView(MasterView): +class LabelProfileView(MasterView): """ Master view for the LabelProfile model. """ @@ -63,14 +63,14 @@ class ProfilesView(MasterView): ] def configure_grid(self, g): - super(ProfilesView, self).configure_grid(g) + super(LabelProfileView, self).configure_grid(g) g.set_sort_defaults('ordinal') g.set_type('visible', 'boolean') g.set_link('code') g.set_link('description') def configure_form(self, f): - super(ProfilesView, self).configure_form(f) + super(LabelProfileView, self).configure_form(f) # format f.set_type('format', 'codeblock') @@ -167,6 +167,9 @@ class ProfilesView(MasterView): config.add_view(cls, attr='printer_settings', route_name='{}.printer_settings'.format(route_prefix), permission='{}.edit'.format(permission_prefix)) +# TODO: deprecate / remove this +ProfilesView = LabelProfileView + def includeme(config): - ProfilesView.defaults(config) + LabelProfileView.defaults(config) diff --git a/tailbone/views/messages.py b/tailbone/views/messages.py index 5f814569..f4c1648c 100644 --- a/tailbone/views/messages.py +++ b/tailbone/views/messages.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -42,7 +42,7 @@ from tailbone.views import MasterView from tailbone.util import raw_datetime -class MessagesView(MasterView): +class MessageView(MasterView): """ Base class for message views. """ @@ -87,12 +87,12 @@ class MessagesView(MasterView): def index(self): if not self.request.user: raise httpexceptions.HTTPForbidden - return super(MessagesView, self).index() + return super(MessageView, self).index() def get_instance(self): if not self.request.user: raise httpexceptions.HTTPForbidden - message = super(MessagesView, self).get_instance() + message = super(MessageView, self).get_instance() if not self.associated_with(message): raise httpexceptions.HTTPForbidden return message @@ -204,7 +204,7 @@ class MessagesView(MasterView): # TODO!! # def make_form(self, instance, **kwargs): - # form = super(MessagesView, self).make_form(instance, **kwargs) + # form = super(MessageView, self).make_form(instance, **kwargs) # if self.creating: # form.id = 'new-message' # form.cancel_url = self.request.get_referrer(default=self.request.route_url('messages.inbox')) @@ -212,7 +212,7 @@ class MessagesView(MasterView): # return form def configure_form(self, f): - super(MessagesView, self).configure_form(f) + super(MessageView, self).configure_form(f) use_buefy = self.get_use_buefy() f.submit_label = "Send Message" @@ -293,7 +293,7 @@ class MessagesView(MasterView): def objectify(self, form, data=None): if data is None: data = form.validated - message = super(MessagesView, self).objectify(form, data) + message = super(MessageView, self).objectify(form, data) if self.creating: if self.request.user: @@ -469,8 +469,11 @@ class MessagesView(MasterView): cls._defaults(config) +# TODO: deprecate / remove this +MessagesView = MessageView -class InboxView(MessagesView): + +class InboxView(MessageView): """ Inbox message view. """ @@ -486,7 +489,7 @@ class InboxView(MessagesView): return q.filter(model.MessageRecipient.status == self.enum.MESSAGE_STATUS_INBOX) -class ArchiveView(MessagesView): +class ArchiveView(MessageView): """ Archived message view. """ @@ -502,7 +505,7 @@ class ArchiveView(MessagesView): return q.filter(model.MessageRecipient.status == self.enum.MESSAGE_STATUS_ARCHIVE) -class SentView(MessagesView): +class SentView(MessageView): """ Sent messages view. """ @@ -585,4 +588,4 @@ def includeme(config): config.add_view(SentView, attr='index', route_name='messages.sent', permission='messages.list') - MessagesView.defaults(config) + MessageView.defaults(config) diff --git a/tailbone/views/people.py b/tailbone/views/people.py index 9deb1cda..54c84d82 100644 --- a/tailbone/views/people.py +++ b/tailbone/views/people.py @@ -44,7 +44,7 @@ from tailbone import forms, grids from tailbone.views import MasterView, AutocompleteView -class PeopleView(MasterView): +class PersonView(MasterView): """ Master view for the Person class. """ @@ -111,7 +111,7 @@ class PeopleView(MasterView): ] def configure_grid(self, g): - super(PeopleView, self).configure_grid(g) + super(PersonView, self).configure_grid(g) g.joiners['email'] = lambda q: q.outerjoin(model.PersonEmailAddress, sa.and_( model.PersonEmailAddress.parent_uuid == model.Person.uuid, @@ -184,7 +184,7 @@ class PeopleView(MasterView): data = form.validated # do normal create/update - person = super(PeopleView, self).objectify(form, data) + person = super(PersonView, self).objectify(form, data) # collect data from all name fields names = {} @@ -227,7 +227,7 @@ class PeopleView(MasterView): customer._people.reorder() # continue with normal logic - super(PeopleView, self).delete_instance(person) + super(PersonView, self).delete_instance(person) def touch_instance(self, person): """ @@ -237,7 +237,7 @@ class PeopleView(MasterView): contact info record associated with them. """ # touch person, as per usual - super(PeopleView, self).touch_instance(person) + super(PersonView, self).touch_instance(person) def touch(obj): change = model.Change() @@ -259,7 +259,7 @@ class PeopleView(MasterView): touch(address) def configure_common_form(self, f): - super(PeopleView, self).configure_common_form(f) + super(PersonView, self).configure_common_form(f) person = f.model_instance f.set_label('display_name', "Full Name") @@ -800,6 +800,9 @@ class PeopleView(MasterView): config.add_view(cls, attr='make_user', route_name='{}.make_user'.format(route_prefix), permission='users.create') +# TODO: deprecate / remove this +PeopleView = PersonView + class PeopleAutocomplete(AutocompleteView): @@ -918,5 +921,5 @@ def includeme(config): config.add_view(PeopleEmployeesAutocomplete, route_name='people.autocomplete.employees', renderer='json', permission='people.list') - PeopleView.defaults(config) + PersonView.defaults(config) PersonNoteView.defaults(config) diff --git a/tailbone/views/products.py b/tailbone/views/products.py index 5ec4b9c5..526a9160 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -77,7 +77,7 @@ log = logging.getLogger(__name__) # return query -class ProductsView(MasterView): +class ProductView(MasterView): """ Master view for the Product class. """ @@ -171,7 +171,7 @@ class ProductsView(MasterView): CurrentPrice = orm.aliased(model.ProductPrice) def __init__(self, request): - super(ProductsView, self).__init__(request) + super(ProductView, self).__init__(request) self.print_labels = request.rattail_config.getbool('tailbone', 'products.print_labels', default=False) def query(self, session): @@ -201,7 +201,7 @@ class ProductsView(MasterView): return query def configure_grid(self, g): - super(ProductsView, self).configure_grid(g) + super(ProductView, self).configure_grid(g) def join_vendor(q): return q.outerjoin(self.ProductVendorCost, @@ -342,7 +342,7 @@ class ProductsView(MasterView): g.set_label('vendor', "Pref. Vendor") def configure_common_form(self, f): - super(ProductsView, self).configure_common_form(f) + super(ProductView, self).configure_common_form(f) product = f.model_instance # upc @@ -594,7 +594,7 @@ class ProductsView(MasterView): return ' '.join(classes) def get_xlsx_fields(self): - fields = super(ProductsView, self).get_xlsx_fields() + fields = super(ProductView, self).get_xlsx_fields() i = fields.index('department_uuid') fields.insert(i + 1, 'department_number') @@ -640,7 +640,7 @@ class ProductsView(MasterView): return fields def get_xlsx_row(self, product, fields): - row = super(ProductsView, self).get_xlsx_row(product, fields) + row = super(ProductView, self).get_xlsx_row(product, fields) if 'upc' in fields and isinstance(row['upc'], GPC): row['upc'] = row['upc'].pretty() @@ -710,7 +710,7 @@ class ProductsView(MasterView): raise httpexceptions.HTTPNotFound() def configure_form(self, f): - super(ProductsView, self).configure_form(f) + super(ProductView, self).configure_form(f) product = f.model_instance # department @@ -880,7 +880,7 @@ class ProductsView(MasterView): def objectify(self, form, data=None): if data is None: data = form.validated - product = super(ProductsView, self).objectify(form, data=data) + product = super(ProductView, self).objectify(form, data=data) # regular_price_amount if (self.creating or self.editing) and 'regular_price_amount' in form.fields: @@ -1792,6 +1792,9 @@ class ProductsView(MasterView): config.add_route('mobile.products.quick_lookup', '/mobile/products/quick-lookup') config.add_view(cls, attr='mobile_quick_lookup', route_name='mobile.products.quick_lookup') +# TODO: deprecate / remove this +ProductsView = ProductView + class ProductsAutocomplete(AutocompleteView): """ @@ -1853,4 +1856,4 @@ def includeme(config): config.add_view(print_labels, route_name='products.print_labels', renderer='json', permission='products.print_labels') - ProductsView.defaults(config) + ProductView.defaults(config) diff --git a/tailbone/views/reportcodes.py b/tailbone/views/reportcodes.py index 63044c3b..ba55db01 100644 --- a/tailbone/views/reportcodes.py +++ b/tailbone/views/reportcodes.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -31,7 +31,7 @@ from rattail.db import model from tailbone.views import MasterView -class ReportCodesView(MasterView): +class ReportCodeView(MasterView): """ Master view for the ReportCode class. """ @@ -51,13 +51,16 @@ class ReportCodesView(MasterView): ] def configure_grid(self, g): - super(ReportCodesView, self).configure_grid(g) + super(ReportCodeView, self).configure_grid(g) g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' g.set_sort_defaults('code') g.set_link('code') g.set_link('name') +# TODO: deprecate / remove this +ReportCodesView = ReportCodeView + def includeme(config): - ReportCodesView.defaults(config) + ReportCodeView.defaults(config) diff --git a/tailbone/views/roles.py b/tailbone/views/roles.py index e30c38be..9b44dcdf 100644 --- a/tailbone/views/roles.py +++ b/tailbone/views/roles.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2020 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -46,7 +46,7 @@ from tailbone.db import Session from tailbone.views.principal import PrincipalMasterView, PermissionsRenderer -class RolesView(PrincipalMasterView): +class RoleView(PrincipalMasterView): """ Master view for the Role model. """ @@ -67,7 +67,7 @@ class RolesView(PrincipalMasterView): ] def configure_grid(self, g): - super(RolesView, self).configure_grid(g) + super(RoleView, self).configure_grid(g) # name g.filters['name'].default_active = True @@ -139,7 +139,7 @@ class RolesView(PrincipalMasterView): raise colander.Invalid(node, "Name must be unique") def configure_form(self, f): - super(RolesView, self).configure_form(f) + super(RoleView, self).configure_form(f) role = f.model_instance use_buefy = self.get_use_buefy() @@ -226,7 +226,7 @@ class RolesView(PrincipalMasterView): """ if data is None: data = form.validated - role = super(RolesView, self).objectify(form, data) + role = super(RoleView, self).objectify(form, data) self.update_permissions(role, data['permissions']) return role @@ -373,6 +373,9 @@ class RolesView(PrincipalMasterView): config.add_view(cls, attr='download_permissions_matrix', route_name='{}.download_permissions_matrix'.format(route_prefix), permission='{}.download_permissions_matrix'.format(permission_prefix)) +# TODO: deprecate / remove this +RolesView = RoleView + class PermissionsWidget(dfwidget.Widget): template = 'permissions' @@ -396,4 +399,4 @@ class PermissionsWidget(dfwidget.Widget): def includeme(config): - RolesView.defaults(config) + RoleView.defaults(config) diff --git a/tailbone/views/settings.py b/tailbone/views/settings.py index 94a71853..ed63b857 100644 --- a/tailbone/views/settings.py +++ b/tailbone/views/settings.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2020 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -43,7 +43,7 @@ from tailbone.db import Session from tailbone.views import MasterView, View -class SettingsView(MasterView): +class SettingView(MasterView): """ Master view for the settings model. """ @@ -59,14 +59,14 @@ class SettingsView(MasterView): ] def configure_grid(self, g): - super(SettingsView, self).configure_grid(g) + super(SettingView, self).configure_grid(g) g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' g.set_sort_defaults('name') g.set_link('name') def configure_form(self, f): - super(SettingsView, self).configure_form(f) + super(SettingView, self).configure_form(f) if self.creating: f.set_validator('name', self.unique_name) @@ -85,6 +85,9 @@ class SettingsView(MasterView): return not bool(self.feedback.match(setting.name)) return True +# TODO: deprecate / remove this +SettingsView = SettingView + class AppSettingsForm(forms.Form): @@ -267,4 +270,4 @@ class AppSettingsView(View): def includeme(config): AppSettingsView.defaults(config) - SettingsView.defaults(config) + SettingView.defaults(config) diff --git a/tailbone/views/shifts/core.py b/tailbone/views/shifts/core.py index 10ceba0b..b33ae0f0 100644 --- a/tailbone/views/shifts/core.py +++ b/tailbone/views/shifts/core.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -48,7 +48,7 @@ def render_shift_length(shift, field): return HTML.tag('span', title="{} hrs".format(hours_as_decimal(length)), c=[pretty_hours(length)]) -class ScheduledShiftsView(MasterView): +class ScheduledShiftView(MasterView): """ Master view for employee scheduled shifts. """ @@ -83,12 +83,15 @@ class ScheduledShiftsView(MasterView): g.set_label('employee', "Employee Name") def configure_form(self, f): - super(ScheduledShiftsView, self).configure_form(f) + super(ScheduledShiftView, self).configure_form(f) f.set_renderer('length', render_shift_length) +# TODO: deprecate / remove this +ScheduledShiftsView = ScheduledShiftView -class WorkedShiftsView(MasterView): + +class WorkedShiftView(MasterView): """ Master view for employee worked shifts. """ @@ -114,7 +117,7 @@ class WorkedShiftsView(MasterView): ] def configure_grid(self, g): - super(WorkedShiftsView, self).configure_grid(g) + super(WorkedShiftView, self).configure_grid(g) g.joiners['employee'] = lambda q: q.join(model.Employee).join(model.Person) g.filters['employee'] = g.make_filter('employee', model.Person.display_name) @@ -146,7 +149,7 @@ class WorkedShiftsView(MasterView): return "WorkedShift: {}, {}".format(shift.employee, date) def configure_form(self, f): - super(WorkedShiftsView, self).configure_form(f) + super(WorkedShiftView, self).configure_form(f) f.set_readonly('employee') f.set_renderer('employee', self.render_employee) @@ -164,7 +167,7 @@ class WorkedShiftsView(MasterView): return tags.link_to(text, url) def get_xlsx_fields(self): - fields = super(WorkedShiftsView, self).get_xlsx_fields() + fields = super(WorkedShiftView, self).get_xlsx_fields() # add employee name i = fields.index('employee_uuid') @@ -176,7 +179,7 @@ class WorkedShiftsView(MasterView): return fields def get_xlsx_row(self, shift, fields): - row = super(WorkedShiftsView, self).get_xlsx_row(shift, fields) + row = super(WorkedShiftView, self).get_xlsx_row(shift, fields) # localize start and end times (Excel requires time with no zone) if shift.punch_in: @@ -200,7 +203,10 @@ class WorkedShiftsView(MasterView): return row +# TODO: deprecate / remove this +WorkedShiftsView = WorkedShiftView + def includeme(config): - ScheduledShiftsView.defaults(config) - WorkedShiftsView.defaults(config) + ScheduledShiftView.defaults(config) + WorkedShiftView.defaults(config) diff --git a/tailbone/views/stores.py b/tailbone/views/stores.py index fa94f92e..a4c4d549 100644 --- a/tailbone/views/stores.py +++ b/tailbone/views/stores.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -36,7 +36,7 @@ from tailbone import grids from tailbone.views import MasterView -class StoresView(MasterView): +class StoreView(MasterView): """ Master view for the Store class. """ @@ -65,7 +65,7 @@ class StoresView(MasterView): } def configure_grid(self, g): - super(StoresView, self).configure_grid(g) + super(StoreView, self).configure_grid(g) g.set_joiner('email', lambda q: q.outerjoin(model.StoreEmailAddress, sa.and_( model.StoreEmailAddress.parent_uuid == model.Store.uuid, @@ -88,7 +88,7 @@ class StoresView(MasterView): g.set_link('name') def configure_form(self, f): - super(StoresView, self).configure_form(f) + super(StoreView, self).configure_form(f) f.remove_field('employees') f.remove_field('phones') @@ -107,6 +107,9 @@ class StoresView(MasterView): (model.StoreEmailAddress, 'parent_uuid'), ] +# TODO: deprecate / remove this +StoresView = StoreView + def includeme(config): - StoresView.defaults(config) + StoreView.defaults(config) diff --git a/tailbone/views/subdepartments.py b/tailbone/views/subdepartments.py index 1e65d56f..0efcbeed 100644 --- a/tailbone/views/subdepartments.py +++ b/tailbone/views/subdepartments.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2020 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -32,7 +32,7 @@ from tailbone.db import Session from tailbone.views import MasterView -class SubdepartmentsView(MasterView): +class SubdepartmentView(MasterView): """ Master view for the Subdepartment class. """ @@ -58,7 +58,7 @@ class SubdepartmentsView(MasterView): ] def configure_grid(self, g): - super(SubdepartmentsView, self).configure_grid(g) + super(SubdepartmentView, self).configure_grid(g) # name g.filters['name'].default_active = True @@ -74,7 +74,7 @@ class SubdepartmentsView(MasterView): g.set_link('name') def configure_form(self, f): - super(SubdepartmentsView, self).configure_form(f) + super(SubdepartmentView, self).configure_form(f) f.remove_field('products') # TODO: figure out this dang department situation.. @@ -98,6 +98,9 @@ class SubdepartmentsView(MasterView): Session.delete(removing) +# TODO: deprecate / remove this +SubdepartmentsView = SubdepartmentView + def includeme(config): - SubdepartmentsView.defaults(config) + SubdepartmentView.defaults(config) diff --git a/tailbone/views/tables.py b/tailbone/views/tables.py index 78363f66..df03a692 100644 --- a/tailbone/views/tables.py +++ b/tailbone/views/tables.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2020 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -29,7 +29,7 @@ from __future__ import unicode_literals, absolute_import from tailbone.views import MasterView -class TablesView(MasterView): +class TableView(MasterView): """ Master view for tables """ @@ -70,6 +70,9 @@ class TablesView(MasterView): g.sorters['row_count'] = g.make_simple_sorter('row_count') g.set_sort_defaults('name') +# TODO: deprecate / remove this +TablesView = TableView + def includeme(config): - TablesView.defaults(config) + TableView.defaults(config) diff --git a/tailbone/views/taxes.py b/tailbone/views/taxes.py index 99177dea..96a404c7 100644 --- a/tailbone/views/taxes.py +++ b/tailbone/views/taxes.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -31,7 +31,7 @@ from rattail.db import model from tailbone.views import MasterView -class TaxesView(MasterView): +class TaxView(MasterView): """ Master view for taxes. """ @@ -53,13 +53,16 @@ class TaxesView(MasterView): ] def configure_grid(self, g): - super(TaxesView, self).configure_grid(g) + super(TaxView, self).configure_grid(g) g.filters['description'].default_active = True g.filters['description'].default_verb = 'contains' g.set_sort_defaults('code') g.set_link('code') g.set_link('description') +# TODO: deprecate / remove this +TaxesView = TaxView + def includeme(config): - TaxesView.defaults(config) + TaxView.defaults(config) diff --git a/tailbone/views/users.py b/tailbone/views/users.py index 228381c9..30937c91 100644 --- a/tailbone/views/users.py +++ b/tailbone/views/users.py @@ -44,7 +44,7 @@ from tailbone.views import MasterView from tailbone.views.principal import PrincipalMasterView, PermissionsRenderer -class UsersView(PrincipalMasterView): +class UserView(PrincipalMasterView): """ Master view for the User model. """ @@ -96,7 +96,7 @@ class UsersView(PrincipalMasterView): ] def query(self, session): - query = super(UsersView, self).query(session) + query = super(UserView, self).query(session) # bring in the related Person(s) query = query.outerjoin(model.Person)\ @@ -105,7 +105,7 @@ class UsersView(PrincipalMasterView): return query def configure_grid(self, g): - super(UsersView, self).configure_grid(g) + super(UserView, self).configure_grid(g) del g.filters['salt'] g.filters['username'].default_active = True @@ -163,7 +163,7 @@ class UsersView(PrincipalMasterView): raise colander.Invalid(node, "Username must be unique") def configure_form(self, f): - super(UsersView, self).configure_form(f) + super(UserView, self).configure_form(f) user = f.model_instance # username @@ -264,7 +264,7 @@ class UsersView(PrincipalMasterView): # create/update user as per normal if data is None: data = form.validated - user = super(UsersView, self).objectify(form, data) + user = super(UserView, self).objectify(form, data) # create/update person as needed names = {} @@ -356,7 +356,7 @@ class UsersView(PrincipalMasterView): .filter(model.UserEvent.user == user) def configure_row_grid(self, g): - super(UsersView, self).configure_row_grid(g) + super(UserView, self).configure_row_grid(g) g.width = 'half' g.filterable = False g.set_sort_defaults('occurred', 'desc') @@ -397,7 +397,7 @@ class UsersView(PrincipalMasterView): } def get_merge_resulting_data(self, remove, keep): - result = super(UsersView, self).get_merge_resulting_data(remove, keep) + result = super(UserView, self).get_merge_resulting_data(remove, keep) result['role_count'] = len(set(remove['_roles'] + keep['_roles'])) return result @@ -428,8 +428,11 @@ class UsersView(PrincipalMasterView): config.add_tailbone_permission(permission_prefix, '{}.edit_roles'.format(permission_prefix), "Edit the Roles to which a {} belongs".format(model_title)) +# TODO: deprecate / remove this +UsersView = UserView -class UserEventsView(MasterView): + +class UserEventView(MasterView): """ Master view for all user events """ @@ -448,11 +451,11 @@ class UserEventsView(MasterView): ] def get_data(self, session=None): - query = super(UserEventsView, self).get_data(session=session) + query = super(UserEventView, self).get_data(session=session) return query.join(model.User) def configure_grid(self, g): - super(UserEventsView, self).configure_grid(g) + super(UserEventView, self).configure_grid(g) g.set_joiner('person', lambda q: q.outerjoin(model.Person)) g.set_sorter('user', model.User.username) g.set_sorter('person', model.Person.display_name) @@ -473,7 +476,10 @@ class UserEventsView(MasterView): if event.user.person: return event.user.person.display_name +# TODO: deprecate / remove this +UserEventsView = UserEventView + def includeme(config): - UsersView.defaults(config) - UserEventsView.defaults(config) + UserView.defaults(config) + UserEventView.defaults(config) diff --git a/tailbone/views/vendors/core.py b/tailbone/views/vendors/core.py index 4a46a075..52b3e5a6 100644 --- a/tailbone/views/vendors/core.py +++ b/tailbone/views/vendors/core.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -35,7 +35,7 @@ from webhelpers2.html import tags from tailbone.views import MasterView, AutocompleteView -class VendorsView(MasterView): +class VendorView(MasterView): """ Master view for the Vendor class. """ @@ -72,7 +72,7 @@ class VendorsView(MasterView): ] def configure_grid(self, g): - super(VendorsView, self).configure_grid(g) + super(VendorView, self).configure_grid(g) g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' @@ -86,7 +86,7 @@ class VendorsView(MasterView): g.set_link('abbreviation') def configure_form(self, f): - super(VendorsView, self).configure_form(f) + super(VendorView, self).configure_form(f) vendor = f.model_instance # default_phone @@ -114,7 +114,7 @@ class VendorsView(MasterView): def objectify(self, form, data=None): if data is None: data = form.validated - vendor = super(VendorsView, self).objectify(form, data) + vendor = super(VendorView, self).objectify(form, data) vendor = self.objectify_contact(vendor, data) if 'orders_email' in data: @@ -164,6 +164,9 @@ class VendorsView(MasterView): (model.VendorContact, 'vendor_uuid'), ] +# TODO: deprecate / remove this +VendorsView = VendorView + class VendorsAutocomplete(AutocompleteView): @@ -178,4 +181,4 @@ def includeme(config): config.add_view(VendorsAutocomplete, route_name='vendors.autocomplete', renderer='json', permission='vendors.list') - VendorsView.defaults(config) + VendorView.defaults(config)