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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:16:57+00:00 2026-05-28T18:16:57+00:00

I am somewhat new to the google app engine models system(and all database models

  • 0

I am somewhat new to the google app engine models system(and all database models for that matter), and I am trying to figure out how make a model have a collection of model instances as one of the properties. Some how I feel that there has to be a better way to model the data I have.

So here is the example. I’m writing a journal webapp. I want to allow users to have multible journals as defined by the model Journals

#Represents a collection of journals
class Journals(db.Model):
    user = db.UserProperty()
    journals = db.ListProperty(int)  #there has to be a better way of keeping track of journals then by a list of their id

In the property journals I keep a list of the id’s of the Journal model(shown below).

class Journal(db.Model):
    user = db.UserProperty()
    name = db.StringProperty()
    date_created = db.DateTimeProperty(auto_now_add=True)
    last_modified = db.DateTimeProperty(auto_now=True)
    journal_item = db.ListProperty(int)

In the Journal model I store a list of id’s of JournalItem instances as a list of id’s

class JournalItem(db.Model):
    user = db.UserProperty()
    name = db.StringProperty()
    date_created = db.DateTimeProperty(auto_now_add=True)
    last_modified = db.DateTimeProperty(auto_now=True)
    content = db.StringProperty(multiline=True)

So I guess the question really is how should I model data with this structure(I omitted some properties to simplify it)(shown in json).

"Journals": {
    "Journal": {
        "user": "GAE user object",
        "name": "journal 1",
        "JournalItems": {
            "JournalItem": {
                "name": "entry 1",
                "content": "some example content"
            },
            "JournalItem": {
                "name": "entry 2",
                "content": "some example content"
            },
            "JournalItem": {
                "name": "entry n",
                "content": "some example content"
            }
        }
    }
    "Journal": {
        "user": "GAE user object",
        "name": "journal 2",
        "JournalItems": {
            "JournalItem": {
                "name": "entry 1",
                "content": "some example content"
            },
            "JournalItem": {
                "name": "entry 2",
                "content": "some example content"
            },
            "JournalItem": {
                "name": "entry n",
                "content": "some example content"
            }
        }
    }
}

I hope that wasn’t to long-winded to be annoying. Any help on the matter would be greatly appreciated.

  • 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-28T18:16:58+00:00Added an answer on May 28, 2026 at 6:16 pm

    That’s pretty much the way to do it, except I would use a ListProperty(db.Key) instead of int. Then you can do db.get(userjournals.journals) to get all the user’s journals once you have the Journals instance belonging to that user (note that to avoid confusion, you should probably call that something like UserJournals).

    Remember that GAE is a non-relational datastore, and sometimes you have to think a bit differently from how you would using SQL.

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

Sidebar

Related Questions

I'm somewhat new to the ASP.NET MVC architecture and I'm trying to sort out
I am somewhat new to using JPA -- I'll put that out there right
I'm somewhat new to object oriented programming in Javascript and I'm trying to build
So I am somewhat new to Rails 3, and I am trying to integrate
Maybe that's a somewhat uncommon question but here we go. Here's the code $userName=(Google);
I am somewhat new to C# and am trying to do a good job
I am somewhat new to PHP coding and I am aware that malicious users
I am somewhat new to jQuery but have been having fun trying learn about
I am somewhat new to unicode and unicode strings. I'm trying to determine the
I am somewhat new to java and was hoping that someone could help me.

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.