Questions tagged [referenceproperty]
28 questions
9
votes
1 answer
In Google App Engine, how do I use reference properties between two entities that reference each other?
If I have two types of models that each reference each other, whichever one I try to define first says it does not recognize the referenced other type (because it is defined further down in the file). For example:
class Author(db.Model):
…

ryan
- 2,311
- 3
- 22
- 28
6
votes
2 answers
How to model entity relationships in GAEJ?
I would like to know -an example is highly appreciated-
How to model relationships in Google App Engine for Java?
-One to Many
-Many to Many
I searched allover the web and I found nothing about Java all guides and tutorials are about Python.
I…

M.ES
- 920
- 14
- 30
3
votes
1 answer
How to set a ReferenceProperty using only a Key, not getting the Model
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 =…

jrnewman42
- 108
- 7
3
votes
3 answers
Get the string-encoded key of an entity from a reference property in appengine
In order to get the string-encoded key of an entity, I just do the following:
key = entity.key()
string_encoded_key = str(key)
I have a reference to another entity via the ReferenceProperty.
class ParentClass(db.Model):
name =…

Albert
- 3,611
- 3
- 28
- 52
2
votes
1 answer
ReferenceProperty failed to be resolved -- App Engine
I am running into an error that I am unable to isolate the root cause of. The error is the following: "ReferenceProperty failed to be resolved: [u'StatusLog', STATUSLOGSID]". This error only occurs sometimes, about once or twice a day. The scripts…

papezjustin
- 2,223
- 6
- 24
- 31
2
votes
2 answers
BlobReferenceProperty and ReferenceProperty model design
I have a design question is BlobReferenceProperty basically ReferenceProperty? Should I do prefetch (suggested by Nick http://blog.notdot.net/2010/01/ReferenceProperty-prefetching-in-App-Engine) like for ReferenceProperty?
Currently I have this…

willi
- 6,559
- 4
- 30
- 27
2
votes
2 answers
How to enumerate the back-references of an entity
In this scenario, company.py contains:
from django.utils import simplejson
class Company(db.Model):
name=db.StringProperty()
address=db.StringProperty()
def to_JSON():
d = dict([(p, unicode(getattr(self, p))) for p in…

Timothy Tripp
- 3,277
- 1
- 14
- 8
1
vote
1 answer
GAE python - how to change the "one" that a "many" object points to?
I'm using the GAE database to store objects of type Supp, which are part of a SuppSet. A SuppSet can have many Supps in it. I'm using the ReferenceProperty model to create the one-to-many relationship between the SuppSet and Supps as follows:
class…

Max Cascone
- 648
- 9
- 25
1
vote
1 answer
How to access items in a model with ReferenceProperty?
This is a follow up on my previous question.
I set up the models with ReferenceProperty:
class User(db.Model):
userEmail = db.StringProperty()
class Comment(db.Model):
user = db.ReferenceProperty(User, collection_name="comments")
…

Zeynel
- 13,145
- 31
- 100
- 145
1
vote
1 answer
How to perform a many-to-many filter using ReferenceProperty in Google App Engine?
This is my model, Players and Clubs. As a Club can have many players and a player can have many clubs (in its carrer), I used a many-to-many relationship:
class Club(db.Model):
name = db.StringProperty()
link = db.StringProperty()
class…

Nuno Cardoso
- 51
- 3
1
vote
1 answer
Get a datastore object by getattr without knowing its class
I want to get a entity through a ReferencePropery in this way.
getattr(model, refrence)
where model is a db.Model and reference is db.ReferenceProperty. But I get a KindError, which I can avoid by adding import of following sort.
from foomodule…

Aruna Herath
- 6,241
- 1
- 40
- 59
1
vote
2 answers
How do we override the choice field display of a reference property in appengine using Django?
The default choice field display of a reference property in appengine returns the choices
as the string representation of the entire object. What is the best method to override this behaviour? I tried to override str() in the referenced class. But…

Sriram
- 838
- 7
- 15
1
vote
1 answer
How can I get a collection of collection
I have these models:
class Country(db.Model):
name = db.StringProperty()
code = db.StringProperty()
class Course(db.Model):
name = db.StringProperty()
description = db.StringProperty()
country =…

cjlallana
- 636
- 4
- 12
1
vote
2 answers
How to get a collection_name without having and instance of the referencing object?
I'm doing a simple program about customers, products and drafts.
Since they are referenced to each other in some way, when I delete one entity of a kind, another entity of another kind might give an error.
Here's what I have:
-customer.py
class…

cjlallana
- 636
- 4
- 12
1
vote
3 answers
GAE DataStore referenceProperty relationship
I am trying to get all parent/children from a one to many relationship. Traditionally, I could do this with a join, but doing so in the datastore is escaping me.
I have found several partial examples to do this, but not one that is complete yet.
I…

stubble jumper
- 275
- 1
- 4
- 10