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

example peewee_simple.py won't run (AttributeError: 'Metadata' object has no attribute 'rel') #179

Open
maxbellec opened this issue Jul 16, 2019 · 1 comment

Comments

@maxbellec
Copy link

by running the example peewee_simple.py as is, I get

$ python peewee_simple.py
Traceback (most recent call last):
  File "peewee_simple.py", line 42, in <module>
    api.add_resource(BookResource)
  File "/home/m/.local/share/virtualenvs/pano-vehicle-version-config-api-JCsed19j/lib/python3.6/site-packages/flask_potion/__init__.py", line 215, in add_resource
    resource.manager = self.default_manager(resource, resource.meta.get('model'))
  File "/home/m/.local/share/virtualenvs/pano-vehicle-version-config-api-JCsed19j/lib/python3.6/site-packages/flask_potion/contrib/peewee/manager.py", line 26, in __init__
    super(PeeweeManager, self).__init__(resource, model)
  File "/home/m/.local/share/virtualenvs/pano-vehicle-version-config-api-JCsed19j/lib/python3.6/site-packages/flask_potion/manager.py", line 27, in __init__
    self._init_model(resource, model, resource.meta)
  File "/home/m/.local/share/virtualenvs/pano-vehicle-version-config-api-JCsed19j/lib/python3.6/site-packages/flask_potion/contrib/peewee/manager.py", line 63, in _init_model
    if column.primary_key or name in model._meta.rel:
AttributeError: 'Metadata' object has no attribute 'rel'
@maxbellec
Copy link
Author

maybe this is linked to #133? By changing

if column.primary_key or name in model._meta.rel: to if column.primary_key or name in model._meta.refs:, it fixes the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant