| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

Google App Engine 型とプロパティクラス

提供: MyMemoWiki
2020年2月15日 (土) 07:32時点におけるPiroto (トーク | 投稿記録)による版 (ページの作成:「==Google App Engine 型とプロパティクラス== [Google App Engine] *http://code.google.com/intl/ja/appengine/docs/python/datastore/typesandpropertyclasses.html…」)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
ナビゲーションに移動 検索に移動

Google App Engine 型とプロパティクラス

[Google App Engine]

Property クラス 値型 並び替え順序
StringProperty str/unicode Unicode(str は ASCII として処理されます)
ByteStringProperty ByteString バイト順
BooleanProperty bool False < True
IntegerProperty int/long 数値
FloatProperty float 数値
DateTimeProperty/DateProperty/TimeProperty datetime.datetime 時系列
ListProperty/StringListProperty サポートされる型の list 昇順なら最小要素単位、降順なら最大要素単位
ReferenceProperty/SelfReferenceProperty db.Key パス要素単位(種類、ID、名前のいずれか、種類、ID、名前のいずれか...)
UserProperty users.User メール アドレス(Unicode)
BlobProperty db.Blob (順序付け不可)
TextProperty db.Text (順序付け不可)
CategoryProperty db.Category Unicode
LinkProperty db.Link Unicode
EmailProperty db.Email Unicode
GeoPtProperty db.GeoPt 緯度の後に経度
IMProperty db.IM Unicode
PhoneNumberProperty db.PhoneNumber Unicode
PostalAddressProperty db.PostalAddress Unicode
RatingProperty db.Rating 数値

GeoPtProperty

設定

from google.appengine.ext import db

class SetGeoPtToHoge(webapp.RequestHandler):
   def get(self):
       lat = self.request.get('lat')
       lon = self.request.get('lon')
       hoge = Hoge()
       hoge.geo_pt = db.GeoPt(lat, lon)
             :

取得

 lat = hoge.geo_pt.lat
 lon = hoge.geo_pt.lon