wlanslovenija / django-tastypie-mongoengine

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

Python3 support? #77

Open prymitive opened 10 years ago

prymitive commented 10 years ago

Example from docs:

from tastypie import authorization
from tastypie_mongoengine import resources
from test_app import documents

class PersonResource(resources.MongoEngineResource):
    class Meta:
        queryset = documents.Person.objects.all()
        allowed_methods = ('get', 'post', 'put', 'delete')
        authorization = authorization.Authorization()

doesn't work with python3:

    def __new__(cls, name, bases, attrs):
        meta = attrs.get('Meta')

        if meta and hasattr(meta, 'queryset'):
>           setattr(meta, 'object_class', meta.queryset.model)
E           AttributeError: 'QuerySet' object has no attribute 'model'

objects.all() doesn't have model attribute that is required here: https://github.com/toastdriven/django-tastypie/blob/master/tastypie/resources.py#L1691

chescales commented 10 years ago

I am also very interested in Py3 support, how is the status on this? Has anyone started on this? Or is it already done? Cheers

mitar commented 10 years ago

Pull requests are welcome. I think this is a blocker as well: https://github.com/MongoEngine/mongoengine/issues/381