got it fixed by using a tricky way.

like this:

@property
def fjword_fjword(self):
    return self.fjword.get().fjword

...

can't use get() in template like this:

 <td>{{nword.fjword.get().fjword}}</td>


在 2013年8月21日星期三UTC+8上午11时59分22秒,JP TONG写道:
>
> I replace DB with NDB, but template use NDB KeyProperty no work,
>
> old DB models
>
> class Jword(db.Model):
>     fjword = db.StringProperty(required=True) #单词
>      fpronunciation = db.StringProperty() #读音
>     fcword = db.StringProperty() #中文词义
>
> class Nword(db.Model):
>     fjword=db.ReferenceProperty(Jword)
>     fdate=db.DateProperty(auto_now=True)
>     flevnum=db.IntegerProperty()
>
> NDB models
>
> class Jword(ndb.Model):
>     fjword = ndb.StringProperty(required=True) #单词
>     fpronunciation = ndb.StringProperty() #读音
>     fcword = ndb.StringProperty() #中文词义
>
> class Nword(ndb.Model):
>     fjword=ndb.KeyProperty(kind=Jword)
>     fdate=ndb.DateProperty(auto_now=True)
>     flevnum=ndb.IntegerProperty()
>   
> template code
>
> {% for nword in newword %}
>   {# Each "nword" is a newword model object. #}
>   {{ nword.full_name|upper }}
>
> <tr>
>  <td><input type="checkbox" name="pitem" value="{{nword.key}}" 
> class="selrow"/></td>
>  <td>{{nword.fjword.fjword}}</td>
>  <td>{{nword.fjword.fpronunciation}}</td>
>  <td>{{nword.fjword.fcword}}</td>
>  <td>{{nword.flevnum}}</td>
>  <td>{{nword.fdate}}</td>
> </tr> 
> {% endfor %}
> -- 
>
> {{nword.fjword.fjword}}  DB disply well, but NDB not display.
>
> Thank.
>
> ---------------------------------
> Sunny
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.

Reply via email to