diff --git a/src/wuttaweb/grids/base.py b/src/wuttaweb/grids/base.py
index 4ff990e..71b6a69 100644
--- a/src/wuttaweb/grids/base.py
+++ b/src/wuttaweb/grids/base.py
@@ -1940,6 +1940,15 @@ class Grid:
})
return filters
+ def object_to_dict(self, obj):
+ """ """
+ try:
+ dct = dict(obj)
+ except TypeError:
+ dct = dict(obj.__dict__)
+ dct.pop('_sa_instance_state', None)
+ return dct
+
def get_vue_context(self):
"""
Returns a dict of context for the grid, for use with the Vue
@@ -1976,7 +1985,7 @@ class Grid:
original_record = record
# convert record to new dict
- record = dict(record)
+ record = self.object_to_dict(record)
# make all values safe for json
record = make_json_safe(record, warn=False)
diff --git a/src/wuttaweb/templates/base.mako b/src/wuttaweb/templates/base.mako
index 14d0306..6e5d004 100644
--- a/src/wuttaweb/templates/base.mako
+++ b/src/wuttaweb/templates/base.mako
@@ -682,13 +682,13 @@
<%def name="render_crud_header_buttons()">
% if master:
% if master.viewing:
- % if instance_editable and master.has_perm('edit'):
+ % if master.editable and instance_editable and master.has_perm('edit'):
% endif
- % if instance_deletable and master.has_perm('delete'):
+ % if master.deletable and instance_deletable and master.has_perm('delete'):
% endif
- % if instance_deletable and master.has_perm('delete'):
+ % if master.deletable and instance_deletable and master.has_perm('delete'):
% endif
- % if instance_editable and master.has_perm('edit'):
+ % if master.editable and instance_editable and master.has_perm('edit'):