django non-rel / Managing per-field indexes on App Engine
I'm trying to move my gae webapp project to django non-rel. I'm pretty new to Python and Django (non-rel). Right now I'm setting up the admin backend.
When I want to look at the history of a model entry I encounter this problem:
Caught DatabaseError while rendering: TextField is not indexed,
by default, so you can't filter on it. Please add an index definition
for the column object_id on the model django.contrib.admin.models.LogEntry
as described here: http://www.allbuttonspressed.com/blog/django/2010/07/Managing-per-field-indexes-on-App-Engine
I followed the advice on the give site, but the problem persists.
My gae_models_settings.py looks like this:
from maps.models import Poll, Choice
from django.contrib.admin.models import LogEntry
FIELD_INDEXES = {
Poll: {'indexed': ['question']},
Choice: {'in开发者_StackOverflow中文版dexed': ['choice']},
LogEntry: {'indexed': ['object_id']},
}
And in my settings.py I added:
GAE_SETTINGS_MODULE = (
'maps.gae_models_settings',
)
Where did I go wrong?
There is a letter missing in 'GAE_SETTINGS_MODULE'.
The correct version is :
GAE_SETTINGS_MODULES = (
'maps.gae_models_settings',
)
if you put ae_models_settings.py in the same level as settings.py, I think it should be:
GAE_SETTINGS_MODULES = (
'gae_models_settings',
)
works for me.
精彩评论