djongo
djongo copied to clipboard
Implemented FieldsArrayField in models
The FieldsArrayField is a custom Django model field that allows you to create an array of fields inside a document. You can specify a base field when you create an instance of FieldsArrayField, and then use the resulting field like a regular Python list.
class Foo(models.Model):
tags = FieldsArrayField(models.CharField(max_length=255), blank=True)
We can instanciate such model just using python list:
foo = Foo(
tags=[ 'foo', 'bar', 'test' ]
)
Not working as expected
from djongo import models
from geocoding_api.API.mixins import TimestampMixin
class Geocoding(TimestampMixin):
searchAddresses = models.fields.FieldsArrayField(models.CharField(max_length=255))
Which give
ValueError('You must specify a base_field')