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

  • Home
  • SEARCH
  • 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 8107285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:43:05+00:00 2026-06-06T00:43:05+00:00

Lets say we have following models. class User(db.Model): username=db.StringProperty() avatar=db.ReferenceProperty() class User(db.Model): username=db.StringProperty() avatar=db.StringProperty()

  • 0

Lets say we have following models.

    class User(db.Model):
        username=db.StringProperty()
        avatar=db.ReferenceProperty()

    class User(db.Model):
        username=db.StringProperty()
        avatar=db.StringProperty()

    class Avatar(db.Model):
        avatarLink=db.StringProperty

    class UserDataHandler:
        def adduserdata():
            userid="uniqueid1"
            avatarid="uniqueid2"
            user=User(key_name=userid)
            avatar=Avatar(key_name=user)
            avatar.avatar="http://zy.jpg"
            avatar.put()
            user.username="username"
            user.avatar=avatar
            #user.avatar=avatarid

Of the above two models of is it better to use ReferenceProperty model or store
key_name of the avatar instead and get Avatar from key. By better I mean which one
uses the least number of database queries.

  • 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-06T00:43:07+00:00Added an answer on June 6, 2026 at 12:43 am

    Both methods will result in the same number of queries; using a ReferenceProperty is just less code you have to write (and thus generally considered the right way to do it).

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

Sidebar

Related Questions

Lets say we have the following models: (simplified) class Collection(models.Model): slug = models.SlugField() class
Lets say a have the following Model public class FirstModel { public List<SecondModel> SecondModels
Let's say I have the following Django models: class A(models.Model): keywords = models.ManyToManyField(Keyword) class
Let's say I have the following: class Employee(models.Model): firstName = models.CharField(max_length = 30) lastName
Let's say I have following ORM classes (fields removed to simplify): class Animal(models.Model): say
Let's say I have the following Django model: class Info(models.Model): instrument = models.ForeignKey('Instrument') date
Let's say I have the following models: Class Wishlist belongs_to :user # User class
Let's say I have the following model: class Contest: title = models.CharField( max_length =
Lets say, I have following models in my Django app. class EventGroup name =
Let's say I have the following classes: class Votable(models.Model): name = ... class Vote(models.Model):

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.