Skip to content

Commit

Permalink
Update JSONField
Browse files Browse the repository at this point in the history
  • Loading branch information
KatherineMichel committed May 17, 2020
1 parent 1a3c1e9 commit 3e7e0bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pinax/eventlog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Log(models.Model):
content_type = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL)
object_id = models.PositiveIntegerField(null=True)
obj = GenericForeignKey("content_type", "object_id")
extra = JSONField(encoder=DjangoJSONEncoder)
extra = JSONField(DjangoJSONEncoder)

@property
def template_fragment_name(self):
Expand Down

1 comment on commit 3e7e0bf

@paltman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSONField from at least Postgres, but likely mysql as well, needs encoder as the kwargs otherwise the DjangoJSONEncoder won't be used and data with Decimal and DateTime objects will cause an exception to occur.

This is fixed in the 5.0.0 release, but if we need to maintain the 4.x line for folks that can't upgrade to Django 3.1, then we should create a 4.x branch and patch this.

Please sign in to comment.