question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does this support the new django.db.models.JSONField?

See original GitHub issue

Django 3.1 introduced a new django.db.models.JSONField (distinct from the PostgreSQL one).

Does this package support it?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
elebummcommented, Nov 12, 2020

The documentation is using the django.contrib.postgres.fields version of JSONField which will soon be deprecated. The reason it wasn’t working for me at first was because I was using the django.db.models in my models.py and used the documentations version to have it run in my admin.

Here is my admin.py:

from django.contrib import admin
from django.db import models # This is the important part here
from django_json_widget.widgets import JSONEditorWidget
from .models import Form, FormSubmission

@admin.register(FormSubmission)
class FormSubmissionAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.JSONField: {'widget': JSONEditorWidget}
        # ^^^^^^^^^^^^^^^^ this is the part you want to change.
    }
2reactions
elebummcommented, Nov 12, 2020

Just looking now that #48 #46 are both pull requests that are updating the README.md

Read more comments on GitHub >

github_iconTop Results From Across the Web

django.contrib.postgres.fields.JSONField to django.db.models ...
Hello,. A project I'm working has a use case for a model with a JSONField. I use Postgres for the db and was...
Read more >
Migrating to the Django 3.1 JSON Field - Oak-Tree Technologies
JSONField allows for you to store semi-structured data alongside other data fields in PostgreSQL, MySQL, and SQLite databases and supports ...
Read more >
Using Django's JSONField? You probably don't need it. Here's ...
If you're using Postgres with Django and importing the JSONField object, you're using JSONB. This is the default in recent Django versions and ......
Read more >
Conditional Django migration based on a field only present in ...
And if I installed Django 3.1 and generated a migration, it could take me from django.contrib.postgres.fields.JSONField to django.db.models.
Read more >
django 3.1: JSONField deprecation warning #265 - GitHub
JSONField is deprecated. Support for it (except in historical migrations) will be removed in Django 4.0. HINT: Use django.db.models.JSONField instead.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found