MongoDB (Djongo) + Django | NoneType' object has no attribute 'attname'

20 Views Asked by At

I try to use MongoDB with Django. After several research, i found that to use both together, i had to:

  1. Downgrade Django to 3.1.12
  2. Install djongo
  3. Dwongrade Pymongo to 3.12.3
  4. Install pytz

Here is my models:

class Choice(models.Model):

choice_text=models.CharField(max_length=200)

votes = models.IntegerField(default=0)

    class Meta:
        abstract=True

class Question(models.Model):

question_text=models.CharField(max_length=200)

pub_date = models.DateTimeField()

choices=models.ArrayField(
model_container=Choice
)

I registered the model to the admin:

from .models import Question
# Register your models here.
admin.site.register(Question)

And run the server: everything goes alright.

However, when i try to add an item via administration site, i got the following exception: ')

0

There are 0 best solutions below