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 7522479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:32:04+00:00 2026-05-30T02:32:04+00:00

Just starting out to program in python and I’m having the following issue. I

  • 0

Just starting out to program in python and I’m having the following issue. I have a template that shows details on a supplier, each supplier has employees and on the template page, I want to show the names of the employees. I know how to do it in the template, but how do you do that in the view?

MODELS:

class Supplier(models.Model):
    co_name = models.CharField(max_length=100)
    co_city = models.CharField(max_length=100)
    co_state = models.CharField(max_length=2)

class Supplieremployees(models.Model):
    supplier = models.ForeignKey(supplier)
    expe_fname = models.CharField(max_length=50)

VIEWS:

def supplier_detail(request, supplier_id):
    s = get_object_or_404(Supplier, pk=supplier_id)
    **test = s.supplieremployees_set.all()**
    return render_to_response('suppliersdb/supplier_detail.html', {'supplier': s})

TEMPLATE:

...i dont want to use this way, how do i translate this into the view?
{% for supplieremployees in supplier.supplieremployees_set.all %}
    <li>IT Focal: {{ supplieremployees.expe_fname }}</li>
{% endfor %}

**TEST: {{ test.expe_fname }}**

nothing shows up for {{ test.expe_fname }}

  • 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-30T02:32:05+00:00Added an answer on May 30, 2026 at 2:32 am
    def supplier_detail(request, supplier_id):
        s = get_object_or_404(Supplier, pk=supplier_id)
        for employee in s.supplieremployees_set.all():
            print employee.expe_fname
        return render_to_response('suppliersdb/supplier_detail.html', {'supplier': s})
    

    from the docs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just starting out in learning Ruby and I've written a program that generates
I'm just starting out writing trying to write a simple program in C and
Just starting out in asp.net. Have just created a login.aspx page in my site
Just starting out with subversion, have set up repos for 3 current projects and
I am just starting out with DI & unit testing and have hit a
So I am just starting out developing PHP web applications and have finished setting
Just starting to figure Python out. I've read this question and its responses: Is
I am just starting out with QT. I have read through some tutorials, and
I am just starting out with Python and decided to try this little project
I'm just starting out with the Scala and am trying a little toy program

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.