Commit 7e8266a0 authored by Petrus J.v.Rensburg's avatar Petrus J.v.Rensburg

Make 'forms' example deployable.

parent d6b827f4
__author__ = 'petrus'
{% extends 'admin/master.html' %}
{% block body %}
{{ super() }}
<div class="row-fluid">
<h1>Flask-Admin example</h1>
<p class="lead">
Custom forms
</p>
<p>
This example shows how you can define your own custom forms by using form rendering rules.
</p>
<p>
It also demonstrates general file handling as well as the handling of image files specifically.
</p>
<a class="btn btn-primary" href="/"><i class="icon-arrow-left icon-white"></i> Back</a>
</div>
{% endblock body %}
\ No newline at end of file
__author__ = 'petrus'
......@@ -19,7 +19,7 @@ app = Flask(__name__, static_folder='files')
app.config['SECRET_KEY'] = '123456790'
# Create in-memory database
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.sqlite'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///sample.sqlite'
app.config['SQLALCHEMY_ECHO'] = True
db = SQLAlchemy(app)
......@@ -155,15 +155,15 @@ class RuleView(sqla.ModelView):
def index():
return '<a href="/admin/">Click me to get to Admin!</a>'
# Create admin
admin = Admin(app, 'Simple Models')
if __name__ == '__main__':
# Create admin
admin = Admin(app, 'Simple Models')
# Add views
admin.add_view(FileView(File, db.session))
admin.add_view(ImageView(Image, db.session))
admin.add_view(RuleView(RuleSample, db.session, name='Rule'))
# Add views
admin.add_view(FileView(File, db.session))
admin.add_view(ImageView(Image, db.session))
admin.add_view(RuleView(RuleSample, db.session, name='Rule'))
if __name__ == '__main__':
# Create DB
db.create_all()
......
{% extends 'admin/master.html' %}
{% block body %}
{{ super() }}
<div class="row-fluid">
<h1>Flask-Admin example</h1>
<p class="lead">
Custom forms
</p>
<p>
This example shows how you can define your own custom forms by using form rendering rules.
</p>
<p>
It also demonstrates general file handling as well as the handling of image files specifically.
</p>
<a class="btn btn-primary" href="/"><i class="icon-arrow-left icon-white"></i> Back</a>
</div>
{% endblock body %}
\ No newline at end of file
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