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

TypeError: Error when calling the metaclass bases #99

Open
farhatnawaz opened this issue Sep 6, 2017 · 1 comment
Open

TypeError: Error when calling the metaclass bases #99

farhatnawaz opened this issue Sep 6, 2017 · 1 comment

Comments

@farhatnawaz
Copy link

Hi, I am writing an API for my application using tastypie-mongoengine but I am getting an error. The error is: TypeError: Error when calling the metaclass bases, object of type 'NoneType' has no len()

My resources.py file is:

import logging
from django.core import serializers
from tastypie.resources import *
from tastypie.authorization import Authorization
from tastypie_mongoengine.resources import MongoEngineResource

from api.models import User

logger = logging.getLogger(__name__)


class UserResource(MongoEngineResource):
    class Meta:
        queryset = User.objects.all()
        resource_name = 'user'
        collection = "user"
        authorization = Authorization()
        excludes = ['password']
        #allowed_methods = ['get']

    def dehydrate(self, bundle):
        # bundle.data['name'] = 'hydrate1'
        print type(bundle)
        bundle.data.save()
        logger.info(serializers.serialize("xml", bundle.data))
        return bundle

Any help?

@JonathanAlvarado
Copy link

Did you figure out how to fix this?

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

2 participants