Note that there are some explanatory texts on larger screens.

plurals
  1. PO'dict' object has no attribute '_meta'
    text
    copied!<pre><code>def participant_specific_donation(self, participant): donations = Donation.objects.filter(participant = participant) helper = {} for donation in donations: ##helper['donation_date'] = donation.date helper['donation_amount'] = donation.amount return helper def participant_specific(request, participant): helper = RelayFunctions() info = helper.participant_specific_donation(participant) info1 = helper.participant_specific_milestone(participant) data = [ 'participant_specific_donation' : info , 'participant_specific_milestone' : info1 ] json_serializer = serializers.get_serializer("json")() response = json_serializer.serialize(data, ensure_ascii=False) return HttpResponse(response, mimetype="application/json") </code></pre> <p>Error: 'dict' object has no attribute '_meta' Does this have to do with how I call the dictionary? I wanted to combine two objects into an one. Then parse it to json.</p> <p>Here's the traceback. </p> <pre><code>Traceback: File "/home/vtrelayc/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) File "/home/vtrelayc/projects/relay/relayapp/views.py" in participant_specific 192. response = json_serializer.serialize(data, ensure_ascii=False) File "/home/vtrelayc/lib/python2.6/site-packages/django/core/serializers/__init__.py" in serialize 98. s.serialize(queryset, **options) File "/home/vtrelayc/lib/python2.6/site-packages/django/core/serializers/base.py" in serialize 46. concrete_model = obj._meta.concrete_model Exception Type: AttributeError at /participants/specific/1/ Exception Value: 'dict' object has no attribute '_meta' def participant_specific(request, participant): helper = RelayFunctions() info = helper.participant_specific_donation(participant) info1 = helper.participant_specific_milestone(participant) data = [ 'participant_specific_donation' : info , 'participant_specific_milestone' : info1 ] json_serializer = serializers.get_serializer("json")() response = json_serializer.serialize(data, ensure_ascii=False) ... return HttpResponse(response, mimetype="application/json") </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload