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

Inline field list type customizations

parent 1fdfd3f3
......@@ -11,8 +11,8 @@ Introduction
Flask-Admin is advanced, extensible and simple to use administrative interface building extension for Flask framework.
It comes with batteries included: model scaffolding for `SQLAlchemy <http://www.sqlalchemy.org/>`_,
`MongoEngine <http://mongoengine.org/>`_, MongoDB and `Peewee <https://github.com/coleifer/peewee>`_ ORMs, simple
file management interface and a lot of usage samples.
`MongoEngine <http://mongoengine.org/>`_, `pymongo <http://api.mongodb.org/python/current/>`_ and `Peewee <https://github.com/coleifer/peewee>`_ ORMs, simple
file management interface and a lot of usage examples.
You're not limited by the default functionality - instead of providing simple scaffolding for the ORM
models, Flask-Admin provides tools that can be used to construct administrative interfaces of any complexity,
......
......@@ -17,6 +17,7 @@ class CustomModelConverter(orm.ModelConverter):
Injects various Flask-Admin widgets and handles lists with
customized InlineFieldList field.
"""
def __init__(self, view):
super(CustomModelConverter, self).__init__()
......
......@@ -95,6 +95,18 @@ class CustomModelConverter(ModelConverter):
class InlineModelConverter(InlineModelConverterBase):
"""
Inline model form helper.
"""
inline_field_list_type = InlineModelFormList
"""
Used field list type.
If you want to do some custom rendering of inline field lists,
you can create your own wtforms field and use it instead
"""
def get_info(self, p):
info = super(InlineModelConverter, self).get_info(p)
......@@ -155,7 +167,7 @@ class InlineModelConverter(InlineModelConverterBase):
setattr(form_class,
prop_name,
InlineModelFormList(child_form,
self.inline_field_list_type(child_form,
info.model,
reverse_field.name,
info,
......
......@@ -380,6 +380,15 @@ class InlineModelConverter(InlineModelConverterBase):
"""
Inline model form helper.
"""
inline_field_list_type = InlineModelFormList
"""
Used field list type.
If you want to do some custom rendering of inline field lists,
you can create your own wtforms field and use it instead
"""
def __init__(self, session, view):
super(InlineModelConverter, self).__init__(view)
self.session = session
......@@ -488,7 +497,7 @@ class InlineModelConverter(InlineModelConverterBase):
# Contribute field
setattr(form_class,
forward_prop.key,
InlineModelFormList(child_form,
self.inline_field_list_type(child_form,
self.session,
info.model,
reverse_prop.key,
......
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