テンプレートでAttributeError: type object 'XXXX' has no attribute '_meta'
82 views
Skip to first unread message
shuitic
unread,
May 2, 2012, 5:29:10 AM5/2/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to kay-users-ja
Kay framework var 1.1.1で、GQLで取得したモデルにアクセスしようとすると、
AttributeError: type object 'XXXX' has no attribute '_meta'
が開発サーバで発生しました。
現象の内容と、回避方法を、何となく把握したので共有します。尚、本番環境では試していません。
発生するタイミングは、
・TaskQueueでモデルDataを作成する(kay framework未使用)
・こんな感じの簡単なモデル取得関数をviewから呼び出す。(kay framework使用)
def getAllBalnd():
return db.GqlQuery("SELECT * FROM Bland")
・テンプレートで取得したコレクションに、こんな感じでアクセスしようとするとAttributeErrorが発生する
{% for bland in blands %}
<li>{{bland.blandName}}</li>
{% endfor %}
・デバッガーで調べてみると、結果から個々の値を取得するとき(blands.get(0))で発生しているようです。