Skip to content

error in rest_framework.PostList when requesting basic ajax example #24

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

Closed
molecular opened this issue Mar 18, 2016 · 2 comments
Closed

Comments

@molecular
Copy link

I setup everything following the README and am getting this error when requesting the basic ajax example http://localhost:8002/basic

(tutovenv) nick@dose  (master) ~/django-api-rest-and-angular\> ./manage.py runserver localhost:8002
Performing system checks...

System check identified no issues (5 silenced).
March 18, 2016 - 05:55:50
Django version 1.9.2, using settings 'example.settings'
Starting development server at http://localhost:8002/
Quit the server with CONTROL-C.
[18/Mar/2016 05:55:58] "GET /basic HTTP/1.1" 200 1104
[18/Mar/2016 05:55:58] "GET /static/js/script.js HTTP/1.1" 304 0
Internal Server Error: /api/posts
Traceback (most recent call last):
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/rest_framework/generics.py", line 243, in get
    return self.list(request, *args, **kwargs)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/rest_framework/mixins.py", line 40, in list
    queryset = self.filter_queryset(self.get_queryset())
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/rest_framework/generics.py", line 67, in get_queryset
    % self.__class__.__name__
AssertionError: 'PostList' should either include a `queryset` attribute, or override the `get_queryset()` method.

I thought maybe the Django version pulled in by requirements.txt was too new (it pulled 1.9.4), so I uninstalled that using pip and installed Django==1.9.2 instead. That didn't help, same error.

EDIT: also tried djangorestframework 3.3.0 instead of 3.3.3, same error

Not sure what to make of it (not an expert obviously).

@kevinastone
Copy link
Owner

Just pushed a fix for this issue in 9656336

@molecular
Copy link
Author

thanks!

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