I have successfully generated the api key by particular user using django-tastypie. Please see below code,
class UserResource(ModelResource):
class Meta:
queryset = User.objects.all()
authorization = ApiKeyAuthentication()
resource_name = 'user'
I try to access the json data using http://10.90.90.95:3000/api/v1/user/?username=ravi&api_key=66184ad5abfbda8fcd1688c9e8a3780842262658gdf&format=json
.It gives the following traceback.
line 590, in authorized_read_list auth_result = self._meta.authorization.read_list(object_list, bundle) AttributeError: 'ApiKeyAuthentication' object has no attribute 'read_list'
.
Please solve my problem. Thanks..
Just came across this same error, and it's because you've mixed up authentication with authorization. So, it should read:
class UserResource(ModelResource):
class Meta:
queryset = User.objects.all()
authentication = ApiKeyAuthentication()
authorization = Authorization()
resource_name = 'user'