示例#1
0
 class Meta:
   resource_name = 'accounts'
   list_allowed_methods = []
   detail_allowed_methods = []
   authentication = ApiKeyTokenAuthentication()
   authorization = Authorization()
   serializer = CustomJSONSerializer(formats=['json'])
示例#2
0
 class Meta:
   queryset = Achievement.objects.all()
   resource_name = 'achievements'
   list_allowed_methods = ['get','post']
   detail_allowed_methods = ['get','put','post','delete']
   authentication = ApiKeyTokenAuthentication()
   authorization = Authorization()
   serializer = CustomJSONSerializer(formats=['json'])
示例#3
0
 class Meta:
   queryset = SettingType.objects.all()
   resource_name = 'setting-types'
   list_allowed_methods = ['get']
   detail_allowed_methods = ['get']
   authentication = ApiKeyTokenAuthentication()
   authorization = Authorization()
   serializer = CustomJSONSerializer(formats=['json'])
示例#4
0
  def is_authenticated_apikey_only(self, request):
    auth_result = ApiKeyTokenAuthentication(require_user=False).is_authenticated(request)

    if isinstance(auth_result, HttpResponse):
      raise ImmediateHttpResponse(response=auth_result)

    if not auth_result is True:
      raise ImmediateHttpResponse(response=http.HttpUnauthorized())
示例#5
0
 class Meta:
   queryset = User.objects.all()
   resource_name = 'users'
   fields = ['id', 'email', 'first_name', 'last_name', 'is_activated', 'newsletter']
   list_allowed_methods = ['get']
   detail_allowed_methods = ['get', 'put']
   authentication = ApiKeyTokenAuthentication()
   authorization = Authorization()
   serializer = CustomJSONSerializer(formats=['json'])