class SkyFileGroupPermissionResource(Resource):
sky_file = fields.ForeignKey(SkyFileResource,'sky_file',null=False)
group_id = fields.ForeignKey(SkyGroupResource,'group_id',null=False)
expires_at = fields.DateTimeField(attribute='expires_at',null=False)
cloud_url = fields.CharField(attribute='cloud_url')
is_active = fields.BooleanField(attribute='is_active',default=False)
new_devices_default_access = fields.BooleanField(attribute='new_devices_default_access',default=False)
class Meta:
queryset = SkyFileGroupPermission.objects.all()
resource_name = 'file_group_permissions'
authentication = ApiKeyAuthentication()
authorization = DjangoAuthorization()
allowed_methods = ['get','post','delete']
def apply_authorization_limits(self,request,object_list):
return object_list.filter(sky_file__storage__user=request.user.skyuser)
def get_object_list(self,request):
return super(SkyFileGroupPermissionResource,self).get_object_list(request).filter(sky_file__storage_user=request.user.skyuser)
Why am I getting 500 INTERNAL SERVER ERROR
tastypie on GET method, all my api's are working fine, except of one, which give me that error
this is traceback message
Traceback (most recent call last):
File "/home/gegham/django-tastypie/tastypie/resources.py", line 202, in wrapper
response = callback(request, *args, **kwargs)
File "/home/gegham/django-tastypie/tastypie/resources.py", line 433, in dispatch_list
return self.dispatch('list', request, **kwargs)
File "/home/gegham/django-tastypie/tastypie/resources.py", line 465, in dispatch
response = method(request, **kwargs)
File "/home/gegham/django-tastypie/tastypie/resources.py", line 1287, in get_list
objects = self.obj_get_list(bundle=base_bundle, **self.remove_api_resource_names(kwargs))
File "/home/gegham/django-tastypie/tastypie/resources.py", line 1097, in obj_get_list
raise NotImplementedError()
NotImplementedError
Do yo have any Idea , why it give that??
According to the Tastypie documentation, get_object_list()
needs to be implemented at the user level. This means that you should not call super()
in the method.
If you were to use a ModelResource
instead of a Resource
, however, then a super()
would be available for you to use.