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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:50:20+00:00 2026-06-09T21:50:20+00:00

I have a set of models Day1, … ,Day7 . How can I use

  • 0

I have a set of models Day1, … ,Day7 .
How can I use an integer 1-7 to use the correct model?

class Day1 (db.Model):    #Monday
    courtday = db.ReferenceProperty(CourtDays)
    startTime = db.TimeProperty()
    endTime = db.TimeProperty()
    startTimeLunch = db.TimeProperty()
    endTimeLunch = db.TimeProperty()
    day = "Monday"

class Day2 (db.Model):    #Tuesday
    courtday = db.ReferenceProperty(CourtDays)
    startTime = db.TimeProperty()
    endTime = db.TimeProperty()
    startTimeLunch = db.TimeProperty()
    endTimeLunch = db.TimeProperty()
    day = "Tuesday"
  • 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-09T21:50:21+00:00Added an answer on June 9, 2026 at 9:50 pm

    You only need one model for a day, since they are all the same..

    class Day (db.Model):
        courtday = db.ReferenceProperty(CourtDays)
        startTime = db.TimeProperty()
        endTime = db.TimeProperty()
        startTimeLunch = db.TimeProperty()
        endTimeLunch = db.TimeProperty()
        name = db.StringProperty()
    
    days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
    for dayname in days:
      newday = Day(name=dayname)
      newday.put()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have my models set up already. class books(models.Model): title = models.CharField... ISBN
Let's say I have a set of Django Models: class Article(models.Model): title = models.CharField(max_length=100,
I have the models set up like this: class ParentModel(models.Model): some_col = models.IntegerField() some_other
I have these models set up in Django: class SourceBusiness(models.Model): source = models.CharField(max_length=100) ...(other
I have a two models set up like this: class User < ActiveRecord::Base #
I have the following models set up: class Contact < ActiveRecord::Base belongs_to :band belongs_to
I have a model set out like so: class Rating # user_id, author_id end
..whatdoyoucallitanyway.. I have this model: class Kaart(models.Model): name = models.CharField(max_length=200, name=Kaardi peakiri, help_text=Sisesta kaardi
I have set up 2 models in Rails: class Category < ActiveRecord::Base attr_accessible :name
I have set up 2 models as following : class Sector < ActiveRecord::Base attr_accessible

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.