python - tastypie obj_delete method does not work -
i have following code in tastypie. "obj_delete" method not work (will not invoked) 'contextresource' class. problem?
class contextresource(modelresource): created_by = fields.foreignkey(userresource, 'created_by', full=true, null=true) class meta: queryset = context.objects.all() resource_name = 'context' authorization = djangoauthorization() authentication = multiauthentication(basicauthentication(), sessionauthentication()) always_return_data = true list_allowed_methods = ['get', 'post', 'put', 'delete'] filtering = { "name": all, "id": all, "query": } def obj_create(self, bundle, **kwargs): print '&& create context' bundle.data['created_by'] = bundle.request.user bundle = super(contextresource, self).obj_create(bundle, **kwargs) self.create_xml(bundle) return bundle def obj_update(self, bundle, **kwargs): bundle = super(contextresource, self).obj_update(bundle, **kwargs) self.create_xml(bundle) return bundle def obj_delete(self, bundle, **kwargs): print 'delete context' bundle = super(contextresource, self).obj_delete(bundle, **kwargs) context_generator = contextgenerator() context_generator.delete(name=bundle.obj.name) return bundle
Comments
Post a Comment