Home > Blockchain >  AttributeError: module 'django.contrib.gis.db.models' has no attribute 'JSONField
AttributeError: module 'django.contrib.gis.db.models' has no attribute 'JSONField

Time:09-27

I'm using a Postgis database for my Django Project which has a field of JSONField in its database. When I run it, I get this error

AttributeError: module 'django.contrib.gis.db.models' has no attribute 'JSONField'

How to solve this issue?

CodePudding user response:

do this:

from django.contrib.postgres.fields.jsonb import JSONField
class Question(models.Model):
     text = JSONField(max_length=200)

This will solve your error

  • Related