Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9269185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:03:09+00:00 2026-06-18T15:03:09+00:00

def participant_specific_donation(self, participant): donations = Donation.objects.filter(participant = participant) helper = {} for donation in

  • 0
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")

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.

Here’s the traceback.

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")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:03:10+00:00Added an answer on June 18, 2026 at 3:03 pm

    There are two problems that I see in the code snippet.

    First, logical issue here :

    for donation in donations:
        ##helper['donation_date'] = donation.date
        helper['donation_amount'] = donation.amount
    

    If donations has multiple elements then you will end up with only the last element in the list, as you are looping over the donations and assigning the value every time to helper.

    I think you want to calculate the total amount, which you can do as shown :

    helper['donation_amount'] += donation.amount
    

    Second, the line :

    data = [ 
        'participant_specific_donation': info,
        'participant_specific_milestone': info1 
    ]
    

    will give you a syntax error.

    It appears that you need a dictionary over here. The correct way to intialize a dictionary is by using the { } braces :

    data = { 
        'participant_specific_donation': info, 
        'participant_specific_milestone': info1
    }
    

    If you want all the donations in a single place, you can make a list first :

    donation_amount = [donation for donation in donations]
    

    and then assign it to the helper dictionary :

    helper['donation_amount'] = donation_amount
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

def participant_specific(request, participant): helper = RelayFunctions() info = helper.participant_specific_donation(participant) info1 = helper.participant_specific_milestone(participant) data =
I have a class that contains this class method: def self.get_event_record(row, participant) event =
def self.get(server) return unless server server = server.to_s if klass = @handlers[server] obj =
def download_if_dne(href, filename): if os.path.isfile(filename): # print 'already downloaded:', href return False else: if
def self.jq_column_models COLUMN_NAME.collect {|x| {:name => x.to_s, :width => 80, :format => 'integer' if
def self.build_prior_month(payee, as_of = Time.current, opts = {}) start_date, end_date, year, month = effective_dates(as_of)
def make_converter(match, replacement): d={match : replacement} return d def apply_converter(converter, string): c1= .join(str(x) for
def isBig(x): if x > 4: return 'apple' else: return 'orange' This works: if
def fun1(a): for i in range(len(a)): a[i] = a[i] * a[i] return a
def primes(n): if n==2: return [2] elif n<2: return [] s=range(3,n+1,2) mroot = n

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.