I can create a MessageResource using post method, however, I want to return something like “message exists” if the MessageResource text has already in database. how to implement it? My MessageResource is
class MessageResource(ModelResource):
class Meta:
queryset = Message.objects.all()
resource_name = "message"
always_return_data = True
authentication = Authentication()
authorization = Authorization()
filtering = {
'body': ALL
}
def determine_format(self, request):
return "application/json"
You can try something like this:
Or you can also use validation.