AppEngine: using Expando class in Django NonRel?

217 views Asked by At

I have an app using using Django Nonrel on AppEngine.

I'd like to use a dynamic model similar to WebApp's db.Expando class - is this possible? Is the Expando class exposed to the DNR layer?

2

There are 2 answers

0
Gagandeep Singh On BEST ANSWER

You can use DictField & ListField from djangotoolbox to create dynamic models in Django-nonrel. For e.g.

from djangotoolbox.fields import DictField

class Image(models.Model):
    exif = DictField()

and,

class Post(models.Model):
    words = ListField(models.CharField(max_length=500))
    title = models.CharField(max_length=200)
    content = models.TextField(blank=True)

See Option 3 of Django dynamic model fields for more details.

2
Nick Johnson On

Django implements its own DB abstraction layer - it's not built on App Engine's db module. If django does not provide it itself, it's not available.