wlanslovenija / django-tastypie-mongoengine

MongoEngine support for django-tastypie.
Other
73 stars 59 forks source link

TypeError: Error when calling the metaclass bases #99

Open farhatnawaz opened 6 years ago

farhatnawaz commented 6 years ago

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 commented 5 years ago

Did you figure out how to fix this?