I have the following error message:
AttributeError: 'module' object has no attribute 'ArrayField'
Here is the relevant code segment:
from __future__ import unicode_literals
from django.db import models
from django.contrib.postgres.fields import ArrayField
class TypeStatistics(models.Model):
bots_array = models.ArrayField(models.CharField(max_length=50), blank=True)
Any idea what can be causing this?
Two things, first make sure that you are using Django version >= 1.8 then change the following line:
bots_array = models.ArrayField(models.CharField(max_length=50), blank=True)
to
bots_array = ArrayField(models.CharField(max_length=50), blank=True)
the django.db.models does not have an ArrayField
but you have imported ArrayField
from contrib postgresql so that's what you should be using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With