How to get a manually assigned parent id that is not yet associated?

I have two objects

child object:

class Currency(db.Model): country = db.ReferenceProperty(Country) #... 

parent object:

 class Country(db.Model): name = db.StringProperty() #... 

I manually assign country currency with appcfg.py upload_data from Currency.cvs file

When I type the console, currency.country.key , I get this error message:

ReferencePropertyResolveError: ReferenceProperty failed to be resolved: [u'Country', 60L]

how can i get this id of a country that is not yet connected?

In addition, it looks like in the data warehouse panel. Currency unit

 Entity Kind Currency Entity Key ahBkZXZ-ZmluZHlvdXJyb29tchALEghDdXJyZW5jeRiw_wEM country(Key) ahBkZXZ-ZmluZHlvdXJyb29tcg0LEgdDb3VudHJ5GDwM Country: id=60 
+4
source share
1 answer

I assume that it is not connected, you mean that the corresponding record was not loaded. You can get the ReferenceProperty key using Currency.country.get_value_for_datastore(currency_instance) .

+3
source

Source: https://habr.com/ru/post/1384735/


All Articles