Skip to content

Commit

Permalink
Update JSONField in evaluate_couch_model_for_sql
Browse files Browse the repository at this point in the history
(fields.W904) django.contrib.postgres.fields.JSONField is deprecated. Support for it (except in historical migrations) will be removed in Django 4.0.
	HINT: Use django.db.models.JSONField instead.
  • Loading branch information
millerdev committed Mar 31, 2022
1 parent 4ad8cb7 commit 6451ce0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def add_arguments(self, parser):
FIELD_TYPE_DATETIME = 'models.DateTimeField'
FIELD_TYPE_DECIMAL = 'models.DecimalField'
FIELD_TYPE_STRING = 'models.CharField'
FIELD_TYPE_JSON = 'JSONField'
FIELD_TYPE_JSON = 'models.JSONField'
FIELD_TYPE_SUBMODEL_LIST = 'models.ForeignKey'
FIELD_TYPE_SUBMODEL_DICT = 'models.OneToOneField'
FIELD_TYPE_UNKNOWN = 'unknown_type'
Expand Down Expand Up @@ -289,7 +289,6 @@ def generate_models_changes(self):
db_table = self.django_app.lower() + "_" + self.class_name.replace("_", "").lower()
sql_model = render_tempate(
"sql_model.j2",
import_json=self.FIELD_TYPE_JSON in self.field_types.values(),
class_name=self.class_name,
migration_field_names=migration_field_names,
suggested_fields=suggested_fields,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{% if import_json %}
from django.contrib.postgres.fields import JSONField
{%- endif %}
from django.db import models
from dimagi.utils.couch.migration import SyncCouchToSQLMixin, SyncSQLToCouchMixin

Expand Down

0 comments on commit 6451ce0

Please sign in to comment.