Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError when giving a column name in the model #44

Closed
ghost opened this issue Jan 3, 2016 · 0 comments
Closed

AttributeError when giving a column name in the model #44

ghost opened this issue Jan 3, 2016 · 0 comments
Labels

Comments

@ghost
Copy link

ghost commented Jan 3, 2016

There's my model:

class Document(BaseModel):
    __tablename__ = 'dcm_documents'
    __searchable__ = ['title', 'description', 'document']

    id = db.Column('dcm_id', db.Integer, primary_key=True)
    title = db.Column('dcm_title', db.String, unique=True)
    description = db.Column('dcm_description', db.String)

This will trigger an AttributeError because Flask-WhooshAlchemy tries to access the model attributes by their names in the table not in the model class:

AttributeError: 'Document' object has no attribute 'dcm_id'

@ghost ghost changed the title AttributeError when giving columns a name in the model AttributeError when giving a column name in the model Jan 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant