python - Django Tastypie not Updating Resource with ManyToManyField -
Why not PUT my resource with a ManyToManyField update?
curl - "frame", "favorites": ["/ API / API" - "V1 / organization / 1 /"]} 'http: // localhost: 8000 / api / v1 / Devices / 2 / I get this response:
HTTP / 1.0400 Requesting Bad Date: Wed, 11 July 2012 22:21:15 GMT Server: WSGISR / 0.1 Python / 2.7.2 Content-Type: App / Jason; Charset = utf-8 {"Favorite": ["\" / api / v1 / Organizations / 1 / \ "is not a valid value for primary key."]} Resources are:
class organization resources (ModelResource): parent_org = fields.ForeignKey ('self', 'parent_org', null = true, absolute = true, empty = true) class meta: permissions_mole = ['Go',] Authentication = APIAuthentication () field = ['name', 'org_type', 'parent_org'] filtering = {'name': ALL, 'org_type': ALL, 'parent_org': ALL_WITH_RELATIONS,} command = '' Name ',] queryset = Organization.objects.all () resource_name =' organization 'class device resource (model resource): Sandidah = Field.Manatomnifefield (Organization Resources, 'Favorite', Zero = True, Full = True) Class Meta: Privilege = APIAuthorization () Authority = APIAuthorization () Field = ['uuid',] Filtering = {'uuid': ALL }} Queryset = Device.objects.all () resource_name = 'devices' validation = FormValidation (form_class = DeviceRegistrationForm) Resource receives on an organization gives this exchange:
curl - dump-header - h "content-type: application / jason" -ex GET http: // localhost: 8000 / api / v1 / organization / 1 / HTTP / 1.0 200 OK date : Wed, Jul 11 Dry 2012 22:38:30 GMT Server: WSGIServer / 0.1 Python / 2.7.2 Content-Type: application / json; Charset = utf-8 {"name": "name", "org_type": "org_type", "parent_org": null, "resource_uri": "/ api / v1 / organizations / 1 /"} This is very similar, but I am not using through many specialties on many of my friendship relations. The problem verification method proves that using FormValidation means that a Yuri / API / V1 / P The organization / 1 / DJ ango will not be valid as an external for the ORM. Instead of using custom verification, the problem is resolved.
Many botanas passed away to bring this information to us.
Comments
Post a Comment