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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:22:17+00:00 2026-06-04T04:22:17+00:00

Given the below model and view, for any given club I am trying to

  • 0

Given the below model and view, for any given club I am trying to display that club’s available courts (“court”) and available times (“avail_time”) in the template. I am having trouble doing this.

Model:

from django.db import models

class Club(models.Model):
    establishment = models.CharField(max_length=200)
    address = models.CharField(max_length=200)
    def __unicode__(self):
    return self.establishment

class Available(models.Model):
    club = models.ForeignKey(Club)
    court = models.CharField(max_length=200)
    avail_time = models.DateTimeField('available time')
    def __unicode__(self):
        return self.court

class Taken(models.Model):
    club = models.ForeignKey(Club)
    court = models.ForeignKey(Available)
    taken_time = models.DateTimeField('taken time')
    userid = models.EmailField(max_length = 75)

View:

def avail_times(request, club_id):
    p = get_object_or_404(Club,pk=club_id)
    return render_to_response('reserve/templates/avail_times.html', {'club':p})

Template:

{% for court in club.court_set.all %}
{{court.court }}
{% endfor %}
  • 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-04T04:22:18+00:00Added an answer on June 4, 2026 at 4:22 am

    Well, you don’t seem to have a Court model, so I’m not sure why you’re trying to call court_set.all. You could use club.available_set.all to show the list of Available instances for that club, which might be what you mean.

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

Sidebar

Related Questions

I am trying to validate my model class using IDataErrorInfo as given below. //Validators
In the code given below, I am trying to modify it in such a
I am trying to convert an array of the RECT structure (given below) into
I want a list view and below of that list view i want one
Given the following view model and action using the DefaultModelBinder , it seems to
My model is given below class Question < ActiveRecord::Base ANSWERS= ['Option 1', 'Option 2',
I am trying to modify model coming from View and then update my database
Having some issues trying to model bind to my view model. The basic viewmodel
In the code given below, I need to position the userid box in the
Hello friends i am running code given below which contains the setLogTimeEntery function and

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.