O'Reilly logo

Django Project Blueprints by Asad Jibran Ahmed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A model for our JSON

As I have mentioned earlier, one of the biggest benefits of using JSON as the definition format for our forms is that it uses just simple text data to encode the definition of complex objects. While some databases such as PostgreSQL have a column type for JSON, others do not. However, because we are dealing with simple text data, we don't need one! We can store our JSON data in a simple TextField and then encode and decode the data to and from a Python dictionary whenever required. In fact, there are many people in the Django community who have already dealt with this problem and open sourced their solutions for us to use.

One such package that I have used in the past is django-jsonfield. You can find it at https://github.com/bradjasper/django-jsonfield ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required