From a11b8d9ff26f6188336d89215727ca1618486385 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 21 Sep 2013 17:09:10 -0700 Subject: [PATCH] Allow overriding form class/factory for CRUD views. --- tailbone/forms/alchemy.py | 2 +- tailbone/views/crud.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tailbone/forms/alchemy.py b/tailbone/forms/alchemy.py index 9b67879c..0a3d6d12 100644 --- a/tailbone/forms/alchemy.py +++ b/tailbone/forms/alchemy.py @@ -26,7 +26,7 @@ FormAlchemy Forms """ -from edbob import Object +from rattail.core import Object from pyramid.renderers import render from ..db import Session diff --git a/tailbone/views/crud.py b/tailbone/views/crud.py index fb010602..7c00da3f 100644 --- a/tailbone/views/crud.py +++ b/tailbone/views/crud.py @@ -81,7 +81,7 @@ class CrudView(View): def fieldset(self, model): return self.make_fieldset(model) - def make_form(self, model, **kwargs): + def make_form(self, model, form_factory=AlchemyForm, **kwargs): if self.readonly: self.creating = False self.updating = False @@ -99,7 +99,7 @@ class CrudView(View): kwargs.setdefault('cancel_url', self.cancel_url) kwargs.setdefault('creating', self.creating) kwargs.setdefault('updating', self.updating) - form = AlchemyForm(self.request, fieldset, **kwargs) + form = form_factory(self.request, fieldset, **kwargs) if form.creating: if hasattr(self, 'create_label'):