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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:34:09+00:00 2026-05-29T19:34:09+00:00

I am new to Django and Python, please forgive me if this is a

  • 0

I am new to Django and Python, please forgive me if this is a noobie question. I have an app where I have 3 views:

#views.py

from django.shortcuts import render_to_response
from django.shortcuts import render
from django.http import HttpResponse, HttpRequest, HttpResponseRedirect
from acme.acmetest.models import Player
from acme.acmetest.models import PickForm

def playerAdd(request, id=None):
    form = PickForm(request.POST or None,
                       instance=id and Player.objects.get(id=id))

    if request.method == 'POST' and form.is_valid():
        form.save()
        return HttpResponseRedirect('/draft/')

    return render(request, 'makepick.html', {'form':form})

def draftShow(request):
    draft_list = Player.objects.all()
context_instance=RequestContext(request)
    return render_to_response('listpicks.html', {'draft_list' :draft_list})

def draftPage(request):
    return render(request, 'pickpage.html')

The playerAdd and draftShow views render correctly when they are call on their own in a browser (mapped to separate URLs on separate HTML documents). The draftPage view calls an HTML page:

pickpage.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML lang="en">
<head>
    <title>PickPage</title>
</head>
<body>

{% include "makepick.html" %}
{% include "listpicks.html" %}

</body>
</HTML>

When I call this page, I only get part of the other two html pages. I get the button on the form, but not the field in which to enter test and I get the text of the listpicks, but not the list that is pulled from the database. These are just html pages, and as I said earlier they work when I call them on their own.

Thank you for you help.

dp

  • 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-29T19:34:10+00:00Added an answer on May 29, 2026 at 7:34 pm

    Your problem is that you’re confusing includes with views.

    When you use an include all that happens is the html for that template is inserted at that point.

    There’s no relation to other views that use the template you’re including. So you have to specify the context for the included templates in the view you’re using.

    So in your case, the context from playerAdd and draftShow isn’t available, because you haven’t added it to the render method in draftPage.

    def draftPage(request):
        form = PickForm()
        draft_list = Player.objects.all()
        context = {
            'form':form,
            'draft_list' :draft_list,
        }
        return render(request, 'pickpage.html', context)
    

    Will give you what you’re after in your view. Just make sure that the form submits to the playerAdd view to process it correctly.

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

Sidebar

Related Questions

Alright, this is probably a really silly question but I am new to Python/Django
I'm fairly new to both Django and Python. This is my first time using
I'm rather new to Django and I'm using Django 1.0. I have this: forms.py:
I a new to django and python. I have however managed to build a
I'm new to Django and Python. When I move my code from my local
Apologies, I am completely new to Django and Python. I have 2 questions. First,
I have a class Book : from django.db import models from users.models import User
I am new to SO and Python/Django, so please bear with me. In my
I'm new to Django (and Python) and I have been trying to work out
I have worked with ASP.NET(C#, classic/MVC), Django(Python) and CI(php) but I am completely new

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.