referenceproperty

Deleting erroneous ReferenceProperty properties in AppEngine

Most of the time, the errors you get from your model properties will happen when you're saving data. For instance, if you try saving a string as an IntegerProperty, that will result in an error. The one exception (no pun intended) is ReferenceProperty. If you have lots of references and you're not completely careful about leaving in bad...

Google App Engine - ReferenceProperty() gives error - Generic reference - Polymodel

Given a Polymodel in Google App Engine, likeso: from google.appengine.ext import db from google.appengine.ext.db import polymodel class Base(polymodel.PolyModel): def add_to_referer(self): Referer(target=self).put() class Referer(db.Model): target = db.ReferenceProperty() @classmethod def who_referred(cls): for ...

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 it does not work. ...

Google app engine datastore reference or not?

hi, i am filling up a big table with text items from different countries. My question is: Should i use a referencePropery to link to languages in another table?. Thats the way i would do it in a normal mysql relational database. or just go redundant and specify the language for each text in the table? Whats better? redundancy & incre...

GAE: Using properties for keys() in ModelChoiceProperty boxes

I have a model User which appears as a ReferenceProperty in another model, Group. When I create a form for Group, using Meta, the form's values contain lots of generated strings. I'd like to stop this, and use the username field of User instead. I already define a key_name. However, str(user.key()) still gives a generated string. I cou...

Google App Engine Datastore query problem

Hi to all, I have the following problem: I'd like to retrieve all products of a category class Category(emodel): name = db.StringProperty() class Channel(emodel): name = db.StringProperty() category = db.ReferenceProperty(Category,collection_name="cat_set") class Product(emodel): name = db.StringProperty() ...

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): most_recent_book = db.ReferenceProperty(Book) class Book(db.Model): author = db.ReferencePr...

how do I obtain all the elements of a generator expression I wrote?

I am using google-app-engine webapp, part of the code is : class Post(db.Model): title = db.StringProperty(required=True) def categories(self): return (x.category for x in self.postcategory_set) class Category(db.Model): name = db.StringProperty() class PostCategory(db.Model): post = db.ReferenceProperty(Post)...

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 Player(db.Model): name = db.StringProperty() link = db.LinkProperty() class...

Need help understanding ReferenceProperty

Say I have two classes: class A(db.Model): class B(db.Model): a_reference = ReferenceProperty(A) I can now do the following: a = A() a.put() b = B(); b.a_reference = a.key() b.put() The documentation states the following two things: The ReferenceProperty value can be used as if it were a model instance, and the datastore...