Commit d12a6e12 authored by Serge S. Koval's avatar Serge S. Koval

Merge pull request #90 from plaes/doc-fixes

Improve docs on how to use custom InlineFormAdmin for inline_models
parents 825e097a 2e86d615
...@@ -70,23 +70,23 @@ class ModelView(BaseModelView): ...@@ -70,23 +70,23 @@ class ModelView(BaseModelView):
Accept enumerable with one of the values: Accept enumerable with one of the values:
1. Child model class 1. Child model class::
class MyModelView(ModelView): class MyModelView(ModelView):
inline_models = (Post,) inline_models = (Post,)
2. Child model class and additional options 2. Child model class and additional options::
class MyModelView(ModelView): class MyModelView(ModelView):
inline_models = [(Post, dict(form_columns=['title']))] inline_models = [(Post, dict(form_columns=['title']))]
3. Django-like ``InlineFormAdmin`` class instance 3. Django-like ``InlineFormAdmin`` class instance::
class MyInlineForm(InlineFormAdmin): class MyInlineModelForm(InlineFormAdmin):
forum_columns = ('title', 'date') form_columns = ('title', 'date')
class MyModelView(ModelView): class MyModelView(ModelView):
inline_models = (MyInlineForm,) inline_models = (MyInlineModelForm(MyInlineModel),)
""" """
def __init__(self, model, name=None, def __init__(self, model, name=None,
...@@ -340,7 +340,7 @@ class ModelView(BaseModelView): ...@@ -340,7 +340,7 @@ class ModelView(BaseModelView):
count += 1 count += 1
flash(ngettext('Model was successfully deleted.', flash(ngettext('Model was successfully deleted.',
'%(count)s models were sucessfully deleted.', '%(count)s models were successfully deleted.',
count, count,
count=count)) count=count))
except Exception, ex: except Exception, ex:
......
...@@ -145,7 +145,7 @@ class ModelView(BaseModelView): ...@@ -145,7 +145,7 @@ class ModelView(BaseModelView):
inline_models = None inline_models = None
""" """
Inline related-model editing for models with parent to child relation. Inline related-model editing for models with parent-child relations.
Accepts enumerable with one of the following possible values: Accepts enumerable with one of the following possible values:
...@@ -161,11 +161,11 @@ class ModelView(BaseModelView): ...@@ -161,11 +161,11 @@ class ModelView(BaseModelView):
3. Django-like ``InlineFormAdmin`` class instance:: 3. Django-like ``InlineFormAdmin`` class instance::
class MyInlineForm(InlineFormAdmin): class MyInlineModelForm(InlineFormAdmin):
forum_columns = ('title', 'date') form_columns = ('title', 'date')
class MyModelView(ModelView): class MyModelView(ModelView):
inline_models = (MyInlineForm,) inline_models = (MyInlineModelForm(MyInlineModel),)
""" """
def __init__(self, model, session, def __init__(self, model, session,
...@@ -657,7 +657,7 @@ class ModelView(BaseModelView): ...@@ -657,7 +657,7 @@ class ModelView(BaseModelView):
self.session.commit() self.session.commit()
flash(ngettext('Model was successfully deleted.', flash(ngettext('Model was successfully deleted.',
'%(count)s models were sucessfully deleted.', '%(count)s models were successfully deleted.',
count, count,
count=count)) count=count))
except Exception, ex: except Exception, ex:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment