Skip to content

Instantly share code, notes, and snippets.

@italomaia
Created April 26, 2014 02:03
Show Gist options
  • Save italomaia/11309843 to your computer and use it in GitHub Desktop.
Save italomaia/11309843 to your computer and use it in GitHub Desktop.
Name collision using flask-admin and modelview
from flask import Flask, Blueprint
from flask.ext.admin import Admin
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.admin.contrib.sqla import ModelView
app = Flask(__name__)
app.debug = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'
db = SQLAlchemy(app)
wiki = Blueprint('wiki', __name__)
app.register_blueprint(wiki)
class Wiki(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(100), unique=True)
content = db.Column(db.Text)
db.create_all()
admin = Admin(app)
admin.add_view(ModelView(Wiki, db.session))
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment