Commit a7d72c4a by aagusti

perbaikan base_view

1 parent d975f9ad
......@@ -18,7 +18,7 @@ Buat Python Virtual Environment, biasanya pada home directory::
Install Production
------------------
$ ~/env/bin/pip install git+https://git.opensipkd.com/aa.gusti/opensipkd-base.git
$ ~/env/bin/pip install git+https://github.com/aagusti/tandur.git
$ cp ~/env/etc/live_opensipkd.tpl ~/env/etc/live_opensipkd.ini
Install Development::
......@@ -44,6 +44,10 @@ pada baris berikut ini::
sqlalchemy.url = postgresql://user:password@localhost:5432/db
script_location = opensipkd.base:alembic
[alembic_tandur]
sqlalchemy.url = postgresql://user:password@localhost:5432/db
script_location = tandur:alembic
Handling Log File:
==================
......
......@@ -174,10 +174,10 @@ class BaseView(object):
table = self.get_item_table()
return dict(form=form.render(), table=table and table.render() or None, scripts=self.form_scripts)
def before_save(self, row):
pass
def before_save(self, row, values):
return row
def after_save(self, row):
def after_save(self, row, values):
pass
def save(self, values, user, row=None):
......@@ -191,10 +191,10 @@ class BaseView(object):
row.from_dict(values)
row.status = 'status' in values and values['status'] and 1 or 0
self.before_save(row)
row = self.before_save(row, values)
DBSession.add(row)
DBSession.flush()
self.after_save(row)
self.after_save(row, values)
return row
def save_request(self, values, row=None):
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!