You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unhandled exception in thread started by <function wrapper at 0xb618caac>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 121, in inner_run
self.check(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 374, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 361, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 24, in check_resolver
for pattern in resolver.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 313, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 306, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name)
File "/home/jonas/django/mysite/mysite/urls.py", line 22, in
url(r'^blog/', include('blog.urls',namespace="blog")),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/init.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name)
File "/home/jonas/django/mysite/blog/urls.py", line 5, in
from .api.BlogModelResources import UserResource
File "/home/jonas/django/mysite/blog/api/BlogModelResources.py", line 4, in
class UserResource(ModelResource):
File "/usr/local/lib/python2.7/dist-packages/tastypie/resources.py", line 1769, in new
setattr(meta, 'object_class', meta.queryset.model) ## AttributeError: 'QuerySet' object has no attribute 'model'
can you please help on this?
thank you very much,
Jonas
The text was updated successfully, but these errors were encountered:
The code is simple:
Models.py
from future import unicode_literals
from mongoengine import *
connect('test',alias='default')
class user(Document):
class Comment (EmbeddedDocument):
content=StringField()
name=StringField(max_length=120)
class Post(Document):
title=StringField(max_length=120, required=True)
author = ReferenceField(user,reverse_delete_rule=CASCADE)
tags=ListField(StringField(max_length=30))
comments=ListField(EmbeddedDocumentField(Comment))
meta={'allow_inheritance':True}
class TextPost(Post):
content = StringField()
class ImagePost(Post):
image_path=StringField()
class LinkPost(Post):
link_url=StringField()
BlogModelResources.py
from tastypie.resources import ModelResource
from blog.models import user
class UserResource(ModelResource):
class Meta:
queryset = user.objects.all()
Django (1.10.1)
django-filter (1.0.1)
django-rest-framework-mongoengine (3.3.1)
django-tastypie (0.13.3)
django-tastypie-mongoengine (0.4.6)
djangorestframework (3.5.3)
pymongo (3.4.0)
I always got the error message:
Unhandled exception in thread started by <function wrapper at 0xb618caac>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 121, in inner_run
self.check(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 374, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 361, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 24, in check_resolver
for pattern in resolver.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 313, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 306, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/home/jonas/django/mysite/mysite/urls.py", line 22, in
url(r'^blog/', include('blog.urls',namespace="blog")),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/init.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/home/jonas/django/mysite/blog/urls.py", line 5, in
from .api.BlogModelResources import UserResource
File "/home/jonas/django/mysite/blog/api/BlogModelResources.py", line 4, in
class UserResource(ModelResource):
File "/usr/local/lib/python2.7/dist-packages/tastypie/resources.py", line 1769, in new
setattr(meta, 'object_class', meta.queryset.model)
## AttributeError: 'QuerySet' object has no attribute 'model'
can you please help on this?
thank you very much,
Jonas
The text was updated successfully, but these errors were encountered: