[Flask] Problem with Flask-Admin

Lorenzo Mainardi lormayna at gmail.com
Mon May 9 05:51:09 EDT 2016


This is my model.py file:

(digitel_task)lorenzo at wolf:~/projects/digitel_task/app$ cat models.py

from app import app,db
class Task(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(40), unique=True)
start_time = db.Column(db.DateTime)
dpc = db.Column(db.DateTime)
duc = db.Column(db.DateTime)
end_time = db.Column(db.DateTime)
tech_priority = db.Column(db.Integer,
db.CheckConstraint('tech_priority>0'),
db.CheckConstraint('tech_priority<3'))
sales_priority = db.Column(db.Integer,
db.CheckConstraint('tech_priority>0'),
db.CheckConstraint('tech_priority<3'))
description = db.Column(db.String(3000), unique=True)
src_ip = db.Column(db.String(16), unique=True)
class Employer(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50), unique=True)
class Status(db.Model):
id = db.Column(db.Integer, primary_key=True)
status = db.Column(db.String(50), unique=True)
color = db.Column(db.String, unique = True)
class MacroProject(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(40), unique=True)

2016-05-08 18:07 GMT+02:00 Andrea D'Amore <and.damore at gmail.com>:

> On 8 May 2016 at 00:18, Lorenzo Mainardi <lormayna at gmail.com> wrote:
> > AttributeError: 'module' object has no attribute 'Status'
> >
> > I really don't know where is the problem.
> > Could you help me?
>
> You need to paste (or attach if pasting isn't feasible) models.py,
> seems you think to have derived a SQLAlchemy Model there but the
> interpreter doesn't agree.
>
> As odd as it is you might be importing a "models" package from global
> site-package, what does models.__file__ say?
>
>
> --
> Andrea
>



-- 
LORENZO MAINARDI
http://blog.mainardi.me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20160509/0073616e/attachment.html>


More information about the Flask mailing list