ignore flask admin warnings

This commit is contained in:
SvyatoslavArtymovych 2023-06-12 11:21:07 +03:00
parent 39411129fe
commit 127d585f79

View File

@ -110,28 +110,33 @@ def create_app(environment="development"):
index_view=CustomAdminIndexView(),
)
for view in [
UsersView(m.User, db.session, name="User", endpoint="/user_"),
BooksView(m.Book, db.session, name="Book", endpoint="/book_"),
CollectionsView(
m.Collection, db.session, name="Collection", endpoint="/collection_"
),
SectionsView(m.Section, db.session, name="Section", endpoint="/section_"),
InterpretationView(
m.Interpretation,
db.session,
name="Interpretation",
endpoint="/interpretation_",
),
CommentView(m.Comment, db.session, name="Comment", endpoint="/comment_"),
TagView(m.Tag, db.session, name="Tag", endpoint="/tag_"),
BookContributorView(
m.BookContributor,
db.session,
name="BookContributor",
endpoint="/book_contributor_",
),
]:
admin.add_view(view)
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", "Fields missing from ruleset", UserWarning)
for view in [
UsersView(m.User, db.session, name="User", endpoint="/user_"),
BooksView(m.Book, db.session, name="Book", endpoint="/book_"),
CollectionsView(
m.Collection, db.session, name="Collection", endpoint="/collection_"
),
SectionsView(m.Section, db.session, name="Section", endpoint="/section_"),
InterpretationView(
m.Interpretation,
db.session,
name="Interpretation",
endpoint="/interpretation_",
),
CommentView(m.Comment, db.session, name="Comment", endpoint="/comment_"),
TagView(m.Tag, db.session, name="Tag", endpoint="/tag_"),
BookContributorView(
m.BookContributor,
db.session,
name="BookContributor",
endpoint="/book_contributor_",
),
]:
admin.add_view(view)
return app