doableware / djongo

Django and MongoDB database connector
https://www.djongomapper.com
GNU Affero General Public License v3.0
1.89k stars 355 forks source link

ArrayField is missing #397

Open losewin opened 4 years ago

losewin commented 4 years ago

I have error on arrayfield I dont why it saus AttributeError: module 'djongo.models' has no attribute 'ArrayField'

from djongo import models

class User(models.Model):
       ....
    history=models.ArrayField(model_container='UserHistory')
       .....

class UserHistory(models.Model):
    firstname=models.CharField(max_length=30,validators=[])
    lastname=models.CharField(max_length=30,validators=[])
    username=models.CharField(max_length=50, unique=True, validators=[validators.EmailValidator(message='Invalid emaild address.')])
    role=models.CharField(max_length=2,choices=User.ROLE_CHOICES)
    is_active=models.BooleanField(default=False)
    update_date = models.DateTimeField(default=timezone.now, blank=True)

    class Meta:
        abstract=True

Django==2.2.6 djongo==1.2.36 sqlparse==0.2.4 gunicorn==20.0.4 django-heroku==0.3.1

Jagl257 commented 4 years ago

Need help with this same error. [#415]

losewin commented 4 years ago

Hi mate, I have an alternative, I use ManyToManyField on this matter, there is a temporary solution to make ArrayField work, but you have to edit the package file of djongo which is not good.