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

  • Home
  • SEARCH
  • 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 3333718
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:49:38+00:00 2026-05-17T23:49:38+00:00

Hello I am trying to display work orders from my mysql database to show

  • 0

Hello I am trying to display work orders from my mysql database to show up in an email. However There is a problem because work_orders is a part of my Class Invoice manytomany field. This gives me this error.

'ManyRelatedManager' object has no attribute 'description'

I not really sure what the problem is. Here are some part of my app that could be helpful.

#views.py
@login_required
def invoice_mail(request, id=1):
    invoices_list = Invoice.objects.filter(pk=id)
    invoice = get_object_or_404(Invoice, pk=id)
    client = invoices_list[0].client
    invoice_no = invoices_list[0].invoice_no
    date = invoices_list[0].date
    work_orders = invoices_list[0].work_orders
    t = loader.get_template('registration/email.txt')
    c = Context({
    'client': client.company,
    'address':client.address,
    'city': client.city,
    'postcode': client.postcode,
    'email': client.email,
    'date': date,
    'invoice_no': invoice_no,
    'work_orders': work_orders.description,
    })
    send_mail('Welcome to My Project', t.render(c), 'jess@example.com', ['tom@example.com'], fail_silently=False)
    return render_to_response('sent_email.html', locals(), context_instance=RequestContext(request))


email.txt

INVOICE


Bill to:                            INVOICE # {{invoice_no}}
{{client}}                          DATE: {{date}}
{{address}}
{{city}}
{{postcode}}
{{email}}

quantity item Description
              {{work_orders.description}}
  • 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-05-17T23:49:38+00:00Added an answer on May 17, 2026 at 11:49 pm

    Unless you added a description field to the manager, the attribute doesn’t exist (as it says).
    Maybe you want to use

    for order in work_orders.all():
        print order.description
    

    or in a template

    {% for order in work_orders.all }}
        {{ order.description }}
    {% endfor %}
    

    And maybe you need to change it in the context

    'work_orders': work_orders
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make work this example from http://developer.android.com/resources/tutorials/views/hello-timepicker.html , no errors while compiling
Hello everyone I'm trying to display my array's values in my View but there
Hello i am trying to write the following function to display 7 days of
Hello I´m trying to automate AZURE VM management like Amazon EC2. Is there any
hello i am trying a sqlite database tutorial to build, but its not working
hello i am trying to load a list of filenames from a folder into
Hello I was trying to remove objects from object array that I have and
Hello I've been trying to display progress using the annular determinate for the last
Hello I am trying to display two different html pages through the same UIViewController
Hello I have been trying to make this form work with no luck, So

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.