From 97c5e97ccb467b21e542141ed118f2ab56f0adef Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 2 Feb 2018 13:16:25 -0600 Subject: [PATCH] Add `append()` and `replace()` methods for core Grid class --- tailbone/grids/core.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tailbone/grids/core.py b/tailbone/grids/core.py index 3a17493f..5cb8f8d2 100644 --- a/tailbone/grids/core.py +++ b/tailbone/grids/core.py @@ -128,12 +128,19 @@ class Grid(object): if key in self.columns: self.columns.remove(key) + def append(self, field): + self.columns.append(field) + def insert_before(self, field, newfield): self.columns.insert_before(field, newfield) def insert_after(self, field, newfield): self.columns.insert_after(field, newfield) + def replace(self, oldfield, newfield): + self.insert_after(oldfield, newfield) + self.hide_column(oldfield) + def set_joiner(self, key, joiner): if joiner is None: self.joiners.pop(key, None)