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

Error with recent mongoengine versions #95

Open
apolkosnik-old opened this issue Mar 21, 2016 · 1 comment
Open

Error with recent mongoengine versions #95

apolkosnik-old opened this issue Mar 21, 2016 · 1 comment

Comments

@apolkosnik-old
Copy link

After upgrading to mongoengine 0.10.x I get this error:

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/data/crits/crits/urls.py", line 46, in
from crits.actors.api import ActorResource, ActorIdentifierResource
File "/data/crits/crits/actors/api.py", line 11, in
class ActorResource(CRITsAPIResource):
File "/Library/Python/2.7/site-packages/tastypie_mongoengine/resources.py", line 225, in new
new_class.base_fields.update(new_class.get_fields(include_fields, excludes))
File "/Library/Python/2.7/site-packages/tastypie_mongoengine/resources.py", line 725, in get_fields
'help_text': f.help_text ,
AttributeError: 'StringField' object has no attribute 'help_text'

If I comment out the line 725 in resources.py, it fixes it for me, but perhaps there's something that I'm missing in my app, that could fix it.

Thanks,
-A

@apolkosnik-old
Copy link
Author

Perhaps changing the code in resources.py to something like this would help:

            kwargs = {
                'attribute': name,
                'unique': f.unique or primary_key,
                'null': not f.required and not primary_key,
            }

            if hasattr(f, 'help_text'):
                kwargs['help_text'] = f.help_text

It fixes it for me.
Thanks!

pavanv added a commit to pavanv/django-tastypie-mongoengine that referenced this issue Jul 22, 2016
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