django jsonfield

46

from django.db import models

class Patient(models.Model):
    name = models.CharField(max_length=256)
    data = models.JSONField()


# Create a patient instance
Patient(name='John Doe', data={
    'address': '123 Some House Number', 
    'city': 'Some City',
    'state': 'Utah',
})

# Filter and delete the patient
Patient.objects.filter(patient='John Doe', data__state='Utah')

Comments

Submit
0 Comments