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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:36:00+00:00 2026-05-20T22:36:00+00:00

I want to be able to, given the key to a model in the

  • 0

I want to be able to, given the key to a model in the datastore, simply set the referenceproperty without loading the model itself (as I don’t need that information).

For example:

class Book(db.Model):
    author = db.StringProperty()
    title = db.StringProperty()

class Review(db.Model):
    book = db.ReferenceProperty(Book)
    description = db.StringProperty()

Assuming that I already have the key to a Book (call it bookKey), but I don’t have the corresponding Book object itself, is there a way to do the equivalent of

review = Review()
review.description = "It was ok, but I would recommend it for insomniacs."
review.book = bookKey

or do I need to

book = Book.get(bookKey) #I don't want this datastore access
                         #as I don't need the book object.
review = Review()
review.description = "It was ok, but I would recommend it for insomniacs."
review.book = book

I’ve found the way to extract the key and ID from the ReferenceProperty using get_value_for_datastore, but I’m after a “set”.

  • 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-20T22:36:01+00:00Added an answer on May 20, 2026 at 10:36 pm

    review.book = bookKey will work just fine, and set the referenceproperty without fetching the model.

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

Sidebar

Related Questions

I want to be able to match against all elements in a given context
For any given file data size, I want to be able to resize (or
I want to be able to take an image that i have already captured
I want to be able to have methods in a module that are not
Given: class StringRecord : INotifyPropertyChanged { public string Key { get; set; } //
Given the following simple table structure (SQL Server 2008), I want to be able
I'm using LaTeX and BibTeX for an article, and I want to able to
Want to be able to provide a search interface for a collection of objects
I want to be able to replicate only the folder structure (not the contents)
I want to be able to do the following actions with a form submit

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.