Skip to content
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

FieldError: Cannot resolve keyword 'system' into field. Choices are: attribute, entity, id, value #6

Open
zeeman opened this issue Jan 9, 2014 · 1 comment

Comments

@zeeman
Copy link
Owner

zeeman commented Jan 9, 2014

import urllib
import urllib2

MY_TOKEN = Token

def api_connect(url, params=None):
    if params:
        url += "?" + urllib.urlencode(params)
    req = urllib2.Request(url)
    req.add_header('Authorization', 'Token ' + MY_TOKEN)
    return urllib2.urlopen(req).read()

query = {'a:operating+system': 'linux'}
print api_connect("http://127.0.0.1:8000/api/v1/core/system/", query)
@zeeman
Copy link
Owner Author

zeeman commented Jan 9, 2014

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/api/v1/core/system/?a%3Aoperating%2Bsystem=linux

Django Version: 1.4.1
Python Version: 2.7.4
Installed Applications:
['funfactory',
'compressor',
'tower',
'cronjobs',
'django_browserid',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.staticfiles',
'commonware.response.cookies',
'djcelery',
'django_nose',
'session_csrf',
'product_details',
'cyder',
'south',
'django_cas',
'djcelery',
'django_extensions',
'django_nose',
'jingo_minify',
'rest_framework',
'django.contrib.sessions',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.admin',
'django.contrib.messages']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'cyder.middleware.dev_authentication.DevAuthenticationMiddleware')


Traceback:
File "/home/zane/cyder-test/cyder/vendor/lib/python/django/core/handlers/base.py" in get_response
111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/rest_framework/viewsets.py" in view
78.             return self.dispatch(request, *args, **kwargs)
File "/home/zane/cyder-test/cyder/vendor/lib/python/django/views/decorators/csrf.py" in wrapped_view
77.         return view_func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/rest_framework/views.py" in dispatch
399.             response = self.handle_exception(exc)
File "/usr/local/lib/python2.7/dist-packages/rest_framework/views.py" in dispatch
396.             response = handler(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/rest_framework/mixins.py" in list
74.         self.object_list = self.filter_queryset(self.get_queryset())
File "/usr/local/lib/python2.7/dist-packages/rest_framework/generics.py" in filter_queryset
179.             queryset = backend().filter_queryset(self.request, queryset, self)
File "/home/zane/cyder-test/cyder/cyder/api/v1/filter.py" in filter_queryset
99.                 parent_ids = reduce((lambda x, y: x & y), parent_set_list)
File "/home/zane/cyder-test/cyder/cyder/api/v1/filter.py" in <genexpr>
98.                     matching(k, q_attributes[k]) for k in q_attributes)
File "/home/zane/cyder-test/cyder/cyder/api/v1/filter.py" in <lambda>
93.                         flat=True
File "/home/zane/cyder-test/cyder/vendor/lib/python/django/db/models/query.py" in values_list
585.                 _fields=fields)
File "/home/zane/cyder-test/cyder/vendor/lib/python/django/db/models/query.py" in _clone
864.             c._setup_query()
File "/home/zane/cyder-test/cyder/vendor/lib/python/django/db/models/query.py" in _setup_query
988.         self.query.add_fields(self.field_names, True)
File "/home/zane/cyder-test/cyder/vendor/lib/python/django/db/models/sql/query.py" in add_fields
1669.                     "Choices are: %s" % (name, ", ".join(names)))

Exception Type: FieldError at /api/v1/core/system/
Exception Value: Cannot resolve keyword 'system' into field. Choices are: attribute, entity, id, value

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

1 participant