我在我的项目中使用的是tastype,get-http方法工作得很好,但是当我尝试发布新数据时,我可以´电话:
from random import randint
from django.conf.urls import url
from tastypie import fields
from tastypie.utils import trailing_slash
from tastypie.resources import ModelResource
from device.models import Device
from tastypie.serializers import Serializer
from tastypie.authorization import Authorization, DjangoAuthorization
class DeviceResource(ModelResource):
service = fields.ToOneField('services.api.resources.ServiceResource', 'service', null=True, blank=True)
class Meta:
always_return_data = True
queryset = Device.objects.all()
fields = ['token', 'description', 'type', 'state','service']
allowed_methods = ['get', 'post']
resource_name = 'device'
autorization = Authorization()
当前版本python 2.7.10 django 1.9 tastypie 0.13.3
目前没有回答
相关问题 更多 >
编程相关推荐