Add basic configure page for Trainwreck

also the beginnings of a "yearly rollover" page which hopefully will
prove useful for helping to automate that, once i figure out how best
to go about it...
This commit is contained in:
Lance Edgar 2022-01-01 19:12:46 -06:00
parent 94883c1433
commit 3aac855fa1
6 changed files with 234 additions and 17 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2021 Lance Edgar
# Copyright © 2010-2022 Lance Edgar
#
# This file is part of Rattail.
#
@ -60,6 +60,7 @@ from webob.compat import cgi_FieldStorage
from tailbone import forms, grids, diffs
from tailbone.views import View
from tailbone.db import Session
from tailbone.config import global_help_url
@ -4412,15 +4413,20 @@ class MasterView(View):
])
if names:
self.Session.query(model.Setting)\
.filter(model.Setting.name.in_(names))\
.delete(synchronize_session=False)
# nb. we do not use self.Session b/c that may not point to
# the Rattail DB for the subclass
Session().query(model.Setting)\
.filter(model.Setting.name.in_(names))\
.delete(synchronize_session=False)
def configure_save_settings(self, settings):
model = self.model
# nb. we do not use self.Session b/c that may not point to the
# Rattail DB for the subclass
session = Session()
for setting in settings:
self.Session.add(model.Setting(name=setting['name'],
value=setting['value']))
session.add(model.Setting(name=setting['name'],
value=setting['value']))
##############################
# Pyramid View Config