我正在为 Google App Engine 创建一个 Django 应用程序。我使用的是 django-nonrel,但使用的是 Google App Engine 模型。
我还想使用 Django 的管理站点。
我的航空公司应用 models.py 是:
from google.appengine.ext import db class Airline(db.Model): name = db.StringProperty(required=True) description = db.TextProperty() notes = db.TextProperty() class Meta: verbose_name_plural = 'Airlines' def __unicode__(self): return self.name
我的 admin.py 是:
from django.contrib import admin from airlines.models import * admin.site.register(Airline)
我执行 GAE runserver 并收到以下错误:
TypeError at /admin/ 'PropertiedClass' object is not iterable
我不能将 Google App Engine 模型与 django-nonrel 管理员一起使用吗?
最佳答案
您不能将 App Engine 模型与 django-nonrel 一起使用。你必须使用 django 模型。这样您的代码就可以重用,并允许您关闭 App Engine 并将您的代码用于另一个数据库。
关于django-admin - 在 django-nonrel 上使用 django-admin,使用 App Engine 模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3357526/