I am trying a query like this:
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?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.