Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
d12a6e12
Commit
d12a6e12
authored
Oct 05, 2012
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #90 from plaes/doc-fixes
Improve docs on how to use custom InlineFormAdmin for inline_models
parents
825e097a
2e86d615
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
view.py
flask_admin/contrib/peeweemodel/view.py
+7
-7
view.py
flask_admin/contrib/sqlamodel/view.py
+5
-5
No files found.
flask_admin/contrib/peeweemodel/view.py
View file @
d12a6e12
...
@@ -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 MyInline
Model
Form(InlineFormAdmin):
for
u
m_columns = ('title', 'date')
form_columns = ('title', 'date')
class MyModelView(ModelView):
class MyModelView(ModelView):
inline_models = (MyInline
Form
,)
inline_models = (MyInline
ModelForm(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 suc
c
essfully deleted.'
,
count
,
count
,
count
=
count
))
count
=
count
))
except
Exception
,
ex
:
except
Exception
,
ex
:
...
...
flask_admin/contrib/sqlamodel/view.py
View file @
d12a6e12
...
@@ -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 MyInline
Model
Form(InlineFormAdmin):
for
u
m_columns = ('title', 'date')
form_columns = ('title', 'date')
class MyModelView(ModelView):
class MyModelView(ModelView):
inline_models = (MyInline
Form
,)
inline_models = (MyInline
ModelForm(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 suc
c
essfully deleted.'
,
count
,
count
,
count
=
count
))
count
=
count
))
except
Exception
,
ex
:
except
Exception
,
ex
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment