Tastypie 'NoneType' object has no attribute '_clone' error

206 views
Skip to first unread message

Rajeev Nair

unread,
Jan 11, 2014, 7:59:54 PM1/11/14
to django-...@googlegroups.com

I am using tastypie (v0.11) and django(v1.6.1) on windows operating system using pycharm IDE. I am using virtual environment within pycharm. The django model and related ORM cruds work fine and I am using postgresql with psycopg2 driver. Now, I am trying to create a simple REST based request-response framework utilizing json payloads. While trying to test the REST request-response, I keep getting a strange error in the response. The error is as follows:

**AttributeError 'NoneType' object has no attribute '_clone' error.** 

The url used for testing is

http://localhost:8000/api/comment?format=json

I have already spent a day trying to figure what's wrong. I tried using two other versions of tastypie (v0.10 and v0.9), but the error remains. Any help and guidance will very much be appreciated. Many thanks !!

My code is as follows:

The django model class

from django.db import models

class Comment(models.Model):
    ID=models.BigIntegerField(primary_key=True)
    text=models.CharField(max_length=200)

The tastypie resource class

from tastypie.resources import ModelResource
from pie.models import Comment

class CommentResource(ModelResource):
    class Meta:
        queryset=Comment.objects.all()
        resource_name="comment"

The urls.py file

from django.conf.urls import patterns, include, url
from pie.api import CommentResource
from django.contrib import admin
admin.autodiscover()

res=CommentResource()

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^api/', include(res.urls)),
)

vedavidh budimuri

unread,
Apr 2, 2015, 6:39:52 PM4/2/15
to django-...@googlegroups.com
I have seen your comments in stackoverflow and i have tried to do the same. But i didn't got the bug resolved. Can you tell me in detail what did you do.
Reply all
Reply to author
Forward
0 new messages