Skip to content

Commit

Permalink
MT-404 eventlog app fix (#3089)
Browse files Browse the repository at this point in the history
* Switch to native JSONField

* (fix) Unused settings imported from django.conf
  • Loading branch information
dyakhnov committed Jun 3, 2021
1 parent e682c97 commit 8a05589
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions tardis/apps/eventlog/models.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from django.core.serializers.json import DjangoJSONEncoder

# pylint: disable=C0412
if "sqlite" in settings.DATABASES["default"]["ENGINE"]:
from .fields import JSONField
elif "mysql" in settings.DATABASES["default"]["ENGINE"]:
# pylint: disable=E0401
from django_mysql.models import JSONField
else:
from django.contrib.postgres.fields import JSONField


class Action(models.Model):
name = models.CharField(max_length=64)
Expand All @@ -33,4 +23,4 @@ class Meta:
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(DjangoJSONEncoder)
extra = models.JSONField(DjangoJSONEncoder)

0 comments on commit 8a05589

Please sign in to comment.