1
내 tastypie 코드 스 니펫은 다음과 같습니다.Django Tastypie의 Resource 인스턴스를 호출하는 방법.?
나는 리소스가 있고 post_list
메서드에는 Mysample
인스턴스가 생성됩니다.
내가 Mysample
인스턴스의 메소드를 호출 할, 내가 Mysample
예를
class MysampleResource(ModelResource):
intfeild1 = fields.IntegerField('intfeild1_id', null=True)
intfeild2 = fields.IntegerField('intfeild1_id')
class Meta:
always_return_data = True
queryset = Mysample.objects.all()
allowed_methods = ['get','post','put','delete',]
authentication = SessionAuthentication()
authorization = MysampleAuthorization()
def post_list(self, request, **kwargs):
result = super(MysampleResource, self).post_list(request, **kwargs)
#here I want to call a method of Mysample Instance.
return result
의 방법을하시기 바랍니다 호출 할 필요가 어디
코드에서 주석을 찾아주십시오, 어떻게 그렇게 제발 도와주세요 도와주세요, 저는 초보자입니다. 따라서 어떤 방법을 대체 할 것인지, 어디에서해야하는지 제안 해주십시오. 당신이 그것을 호출 할 수 있습니다
def test_method(self,param*):
#Do your stuff
return result
및 post_list 내
좋아 :
당신은 어떤 오류가 있습니까이? any.It가 나오면 오류를 추가하십시오. 언급 한대로 작동해야합니다. –