0
나는 파이썬 2.7과 구글 앱 엔진을 사용하여 내 페이지 내에서 커서 페이징을 사용하는
https://github.com/GoogleCloudPlatform/appengine-paging-python/blob/master/suggest_cursor.py에 주어진 예를 재현하려고하고
(참조 https://developers.google.com/appengine/articles/paging)형식 오류 : 단항에 대한 잘못된 피연산자 유형 : - 'DateTimeProperty'
데이터 모델 평
class Feedback(db.Model):
user = db.ReferenceProperty(User)
subject = db.StringProperty()
text = db.TextProperty(default='')
created = db.DateTimeProperty(auto_now_add=True)
내 코드 조용한 비슷한을 보이지만 오류 얻을 :
1)
query = datamodel.Feedback.all().order(-datamodel.Feedback.created)
TypeError: bad operand type for unary -: 'DateTimeProperty'
을 제거와
2) -. 쿼리 = datamodel.Feedback.all() 위해 (datamodel.Feedback.created)의 결과는이 오류
File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 2614, in order
if property.startswith('-'):
AttributeError: 'DateTimeProperty' object has no attribute 'startswith'
예상대로이 작동하지 않습니다 이유는 어떤 생각인가?
아 덕분에, 나는 예 기반 NDB되었다는 것을 인정하지 않았다 어떤 데이터 모델이 없었다한다. 심지어 ndb에 대해 몰랐습니다! 고마워 – skurt