def top_level(self, request, api_name=None): """This is the same method in the Api model with the execption of the serializer used. This uses the SafeSerializer. """ serializer = SafeSerializer() available_resources = {} if api_name is None: api_name = self.api_name for name in sorted(self._registry): available_resources[name] = { 'list_endpoint': self._build_reverse_url("api_dispatch_list", kwargs={ 'api_name': api_name, 'resource_name': name, }), 'schema': self._build_reverse_url("api_get_schema", kwargs={ 'api_name': api_name, 'resource_name': name, }), } desired_format = determine_format(request, serializer) options = {} if 'text/javascript' in desired_format: callback = request.GET.get('callback', 'callback') if not is_valid_jsonp_callback_value(callback): raise BadRequest('JSONP callback name is invalid.') options['callback'] = callback serialized = serializer.serialize(available_resources, desired_format, options) return HttpResponse(content=serialized, content_type=build_content_type(desired_format))
class Meta: queryset = User.objects.all() resource_name = 'user' serializer = SafeSerializer() authorization = Authorization() authentication = DeveloperApiKeyAuthentication() validation = CleanedDataFormValidation(form_class=UserForm) list_allowed_methods = ['get', 'post'] detail_allowed_methods = ['get', 'put', 'delete'] excludes = ['username', 'password']
class Meta: queryset = PaymentMethod.objects.all() resource_name = 'payment_method' serializer = SafeSerializer() authorization = Authorization() authentication = DeveloperApiKeyAuthentication() list_allowed_methods = [ 'get', ] detail_allowed_methods = [ 'get', ]
class Meta: abstract = True object_class = None # Replaced by abstract=True in tastypie 0.14.1 serializer = SafeSerializer() authorization = Authorization() authentication = DeveloperApiKeyAuthentication()
class Meta: serializer = SafeSerializer() authorization = Authorization() authentication = DeveloperApiKeyAuthentication()