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

Bug fix #68

Open
Lord-Evil opened this issue Oct 18, 2015 · 0 comments
Open

Bug fix #68

Lord-Evil opened this issue Oct 18, 2015 · 0 comments

Comments

@Lord-Evil
Copy link

First time I'm trying to use MongoDB with Django.
Error in your module.. boom!

/usr/lib/python3.4/site-packages/djangotoolbox/db/base.py in _value_for_db_collection(self, value, field, field_kind, db_type, lookup)
    481                 # "list" may be used for SetField.
    482                 #print("Type: "+str(db_type))
--> 483                 if db_type in 'list':
    484                     return list(value)
    485                 elif db_type == 'set':

TypeError: 'in <string>' requires string as left operand, not NoneType

When trying to create ListField() in the model as per example.
3-4 hours of debugging step by step brought me to this solution:

class NonrelDatabaseWrapper(BaseDatabaseWrapper):
   data_types={'ListField':'list'}

Next step is to solve this crap:

/usr/lib/python3.4/site-packages/django/db/models/fields/__init__.py in get_prep_value(self, value)
    983         if value is None:
    984             return None
--> 985         return int(value)
    986 
    987     def contribute_to_class(self, cls, name, **kwargs):

TypeError: int() argument must be a string, a bytes-like object or a number, not 'ObjectId'

When saving the actual model.

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