Skip to content

Commit

Permalink
fix: django.contrib.postgres.fields.JSONField causes an error in Djan…
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Nov 11, 2024
1 parent d5520de commit 88d90eb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions opencivicdata/core/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import re
import uuid
from django.db import models
from django.contrib.postgres.fields import ArrayField, JSONField
from django.contrib.postgres.fields import ArrayField
from django.core.validators import RegexValidator

from ... import common
Expand Down Expand Up @@ -53,7 +53,7 @@ class OCDBase(models.Model):
auto_now=True,
help_text="The last time this object was seen in a scrape."
)
extras = JSONField(
extras = models.JSONField(
default=dict,
blank=True,
help_text="A key-value store for storing arbitrary information not covered elsewhere.",
Expand Down
8 changes: 4 additions & 4 deletions opencivicdata/legislative/models/bill.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import unicode_literals
from django.db import models
from django.contrib.postgres.fields import ArrayField, JSONField
from django.contrib.postgres.fields import ArrayField
from django.contrib.postgres.search import SearchVectorField
from django.contrib.postgres.indexes import GinIndex

Expand Down Expand Up @@ -101,7 +101,7 @@ class BillAction(RelatedBase):
base_field=models.TextField(), blank=True, default=list
) # enum
order = models.PositiveIntegerField()
extras = JSONField(default=dict, blank=True)
extras = models.JSONField(default=dict, blank=True)

class Meta:
db_table = "opencivicdata_billaction"
Expand Down Expand Up @@ -170,7 +170,7 @@ class BillDocument(RelatedBase):
bill = models.ForeignKey(Bill, related_name="documents", on_delete=models.CASCADE)
note = models.CharField(max_length=300)
date = models.CharField(max_length=10) # YYYY[-MM[-DD]]
extras = JSONField(default=dict, blank=True)
extras = models.JSONField(default=dict, blank=True)

def __str__(self):
return "{0} document of {1}".format(self.date, self.bill)
Expand All @@ -183,7 +183,7 @@ class BillVersion(RelatedBase):
bill = models.ForeignKey(Bill, related_name="versions", on_delete=models.CASCADE)
note = models.CharField(max_length=300)
date = models.CharField(max_length=10) # YYYY[-MM[-DD]]
extras = JSONField(default=dict, blank=True)
extras = models.JSONField(default=dict, blank=True)

def __str__(self):
return "{0} version of {1}".format(self.date, self.bill)
Expand Down
4 changes: 2 additions & 2 deletions opencivicdata/legislative/models/event.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.contrib.gis.db import models
from django.contrib.postgres.fields import ArrayField, JSONField
from django.contrib.postgres.fields import ArrayField
from opencivicdata.core.models.base import (
OCDBase,
LinkBase,
Expand Down Expand Up @@ -161,7 +161,7 @@ class EventAgendaItem(RelatedBase):
subjects = ArrayField(base_field=models.TextField(), blank=True, default=list)
notes = ArrayField(base_field=models.TextField(), blank=True, default=list)
event = models.ForeignKey(Event, related_name="agenda", on_delete=models.CASCADE)
extras = JSONField(default=dict, blank=True)
extras = models.JSONField(default=dict, blank=True)

def __str__(self):
return "Agenda item {0} for {1}".format(self.order, self.event).replace(
Expand Down
4 changes: 2 additions & 2 deletions opencivicdata/legislative/models/vote.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.db import models
from django.contrib.postgres.fields import ArrayField, JSONField
from django.contrib.postgres.fields import ArrayField

from opencivicdata.core.models.base import OCDBase, LinkBase, OCDIDField, RelatedBase
from opencivicdata.core.models import Organization, Person
Expand Down Expand Up @@ -48,7 +48,7 @@ class VoteEvent(OCDBase):
on_delete=models.SET_NULL,
)

extras = JSONField(default=dict, blank=True)
extras = models.JSONField(default=dict, blank=True)

def __str__(self):
if self.identifier:
Expand Down

0 comments on commit 88d90eb

Please sign in to comment.