Django-nonrel in Google App Engine ListField -
i trying build example app in google app engine using django-nonrel. , having problems implementing listfield attribute model.
i have created app test_model , have included installed app in settings. model.py is:
django.db import models djangotoolbox import * dbindexer import * # create models here. class example(models.model): some_choices = models.listfield('choice_examples') notes = models.charfield(max_length='20') updated_at = models.datetimefield(auto_now=true) def __unicode__(self): return u'%s' % (self.notes) class choice_examples(models.model): name = models.charfield(max_length='30') def __unicode__(self): return u'%s' % (self.name)
the above example gives me:
attributeerror:'module' object has no attribute 'model'
if comment out djangotoolbox import, following :
attributeerror: 'module' object has no attribute 'listfield'
what doing wrong here? can't seem find documention how go using listfield in django-nonrel. because supposed obvious?
your imports smashing each other:
from django.db import models djangotoolbox import *
the second import replace django.db models djangotoolbox' empty models module. using from x import *
terrible idea in general in python , produces confusing results these.
if you're looking use listfield djangotoolbox, use:
from djangotoolbox import fields
and refer listfield class fields.listfield
.
Comments
Post a Comment