Deprecation warning in unmaintained 3rd party app used in old migrations (django-jsonfield)

Hi everyone,

I’m preparing my project for the 4.0 release and came up with an issue that I’m not sure how to address.

I have models that use a JSONField. Nowadays, they use Django’s builtin JSONField but before that, they were using the implementation from django-jsonfield (which is now unmaintained).
As a consequence, my migration files still reference django-jsonfield.

My issue is that I’m getting some deprecation warnings when running with python -Wall:
/path/to/venv/jsonfield/fields.py:22: RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is deprecated in favor of django.utils.translation.gettext_lazy().

As mentionned above, django-jsonfield is (understandably) unmaintained and its repository on github is archived/readonly so I can’t file a bug report.

So how would you approach this? Should I maintain a fork of django-jsonfield so i can keep referencing it in my migrations? Should I try to reset my migration files (delete all of them and start with a fresh makemigrations)? Edit the problematic migration files by hand to replace the reference to the old JSONField with some kind of simplified fake object? Maybe another option?

Thanks

I would edit the migration files to use Django’s built-in JSONField, and uninstall django-jsonfield. That should work fine.

That seems to have worked indeed. makemigrations is not reporting any new changes at least.

Thanks :sparkles:

Great! We could do with some documentation around these kinds of changes. I’d be happy to review a PR.