result = json.dumps([a.get_json() for a in Player.objects.filter((Q(name=namepost) | Q(surname="Coimbra")))])
return HttpResponse (result, content_type = 'application / json')But it gives me the following error: Not a query object: (AND: ('surname', 'Coimbra'), ('name', u'Rui ')). Did you intend to use key = value?
get_json def (self):
return {
'name': self.name,
'surname': self.surname,
'country': [{'name': b.name} for b in self.country]
}
If I do well
result = json.dumps([a.get_json() for a in Player.objects.filter(name=namepost)])works well
What am I doing wrong? Someone can help me?