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
Hi,
I am receiving KeyError when I have ALL_WITH_RELATIONS filtering for my Resource. Below is the snapshot of my filters:
filtering = {
'first_name': ALL,
'last_name': ALL,
'gender': ALL,
'availability': ALL,
'date_of_birth': ALL,
'is_verified': ALL,
'status': ALL,
'user': ALL_WITH_RELATIONS,
'assessment_interview': ALL_WITH_RELATIONS,
'created_on': ALL_WITH_RELATIONS,
'updated_on': ALL_WITH_RELATIONS
}
The following Traceback is thrown by tastypie-swagger:
Internal Server Error: /api/v1/doc/schema/employee/
Traceback (most recent call last):
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = wrapped_callback(request, callback_args, *callback_kwargs)
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
return self.dispatch(request, args, *kwargs)
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
return handler(request, args, *kwargs)
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/django/views/generic/base.py", line 154, in get
context = self.get_context_data(**kwargs)
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/views.py", line 138, in get_context_data
'apis': mapping.build_apis(),
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 411, in build_apis
apis = [self.build_list_api(), self.build_detail_api()]
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 383, in build_list_api
list_api['operations'].append(self.build_list_operation(method='get'))
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 334, in build_list_operation
'parameters': self.build_parameters_for_list(method=method),
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 147, in build_parameters_for_list
parameters = self.build_parameters_from_filters(method=method)
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 230, in build_parameters_from_filters
parameters.extend(related_mapping.build_parameters_from_filters(prefix="%s%s" % (prefix, name)))
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 230, in build_parameters_from_filters
parameters.extend(related_mapping.build_parameters_from_filters(prefix="%s%s" % (prefix, name)))
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 230, in build_parameters_from_filters
parameters.extend(related_mapping.build_parameters_from_filters(prefix="%s%s" % (prefix, name)))
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 203, in build_parameters_from_filters
has_related_resource = hasattr(self.resource.fields[name], 'get_related_resource')
KeyError: 'job_talent'
The text was updated successfully, but these errors were encountered:
The filtering your are showing above is not the one involved in the error. It may be related to one of the child resource involved in one of the relation though.
The first thing I can think of is that you are referencing 'job_talent' as a key in another resource's filtering dict and that name is not valid.
AyumuKasuga
added a commit
to AyumuKasuga/django-tastypie-swagger
that referenced
this issue
Nov 12, 2015
Hi,
I am receiving KeyError when I have ALL_WITH_RELATIONS filtering for my Resource. Below is the snapshot of my filters:
filtering = {
'first_name': ALL,
'last_name': ALL,
'gender': ALL,
'availability': ALL,
'date_of_birth': ALL,
'is_verified': ALL,
'status': ALL,
'user': ALL_WITH_RELATIONS,
'assessment_interview': ALL_WITH_RELATIONS,
'created_on': ALL_WITH_RELATIONS,
'updated_on': ALL_WITH_RELATIONS
}
The following Traceback is thrown by tastypie-swagger:
Internal Server Error: /api/v1/doc/schema/employee/
Traceback (most recent call last):
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = wrapped_callback(request, callback_args, *callback_kwargs)
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
return self.dispatch(request, args, *kwargs)
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
return handler(request, args, *kwargs)
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/django/views/generic/base.py", line 154, in get
context = self.get_context_data(**kwargs)
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/views.py", line 138, in get_context_data
'apis': mapping.build_apis(),
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 411, in build_apis
apis = [self.build_list_api(), self.build_detail_api()]
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 383, in build_list_api
list_api['operations'].append(self.build_list_operation(method='get'))
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 334, in build_list_operation
'parameters': self.build_parameters_for_list(method=method),
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 147, in build_parameters_for_list
parameters = self.build_parameters_from_filters(method=method)
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 230, in build_parameters_from_filters
parameters.extend(related_mapping.build_parameters_from_filters(prefix="%s%s" % (prefix, name)))
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 230, in build_parameters_from_filters
parameters.extend(related_mapping.build_parameters_from_filters(prefix="%s%s" % (prefix, name)))
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 230, in build_parameters_from_filters
parameters.extend(related_mapping.build_parameters_from_filters(prefix="%s%s" % (prefix, name)))
File "/home/soheltarir/django-workspace/local/lib/python2.7/site-packages/tastypie_swagger/mapping.py", line 203, in build_parameters_from_filters
has_related_resource = hasattr(self.resource.fields[name], 'get_related_resource')
KeyError: 'job_talent'
The text was updated successfully, but these errors were encountered: