Allow overriding form class/factory for CRUD views.

This commit is contained in:
Lance Edgar 2013-09-21 17:09:10 -07:00
parent 9f8a3d3a5c
commit a11b8d9ff2
2 changed files with 3 additions and 3 deletions

View file

@ -26,7 +26,7 @@
FormAlchemy Forms
"""
from edbob import Object
from rattail.core import Object
from pyramid.renderers import render
from ..db import Session

View file

@ -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'):