# modelform JSON to chekbox

**URL:** <https://forum.djangoproject.com/t/modelform-json-to-chekbox/13131>\
**Category:** Forms & APIs\
**Created:** [April 12, 2022, 5:19pm UTC](https://forum.djangoproject.com/t/modelform-json-to-chekbox/13131 "2022-04-12T17:19:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![csaba911](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/csaba911/32/3378_2.png) [@csaba911](https://forum.djangoproject.com/u/csaba911)\
**Post date:** [April 12, 2022, 5:19pm UTC](https://forum.djangoproject.com/t/modelform-json-to-chekbox/13131/1 "2022-04-12T17:19:45Z")

</div>

mysql store JSON as longtext and form rendered as textarea, how can I render 3 checkbox ?  
Searched for hours and no example what I could implement without using third party plugin, any advise?  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/4/4dee125f5292cb35f4f5530cbfb345d4899a280e.png)

```auto
#model
class SafetyCheck(models.Model):
        user = models.ForeignKey(tech, on_delete=models.DO_NOTHING)
        order_number = models.CharField(max_length=64)
        order_type = models.CharField(max_length=16)
        order_date = CustomDateTimeField(auto_now=True)
        certification = models.JSONField(null=True)

#modelForms
class JobSafetyCheckForm((forms.ModelForm):
         Meta:
         model=job
         fields = ['user', 'order_number ', 'order_type', 'certification']

#html render form as {{ form | crispy }}
#json data 
{
  "certification": {
    "site": "True",
    "vehicle": "False",
    "ppe": "True"
  }
}

```

This is what I would like to achieve ::

![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/e/eee4ecfc8d1ee4b937af22ef7b1e786191f6deb6.png)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [April 12, 2022, 6:40pm UTC](https://forum.djangoproject.com/t/modelform-json-to-chekbox/13131/2 "2022-04-12T18:40:04Z")

</div>

You are going to need to do this manually (or find a third-party library) to do this.

You will not want the certification field to be one of the model fields being rendered. You’ll want to dynamically create the fields in your form based upon the data in `certification`.

You’ll then need to handle those fields when being posted back to the form and recreate the JSON data from it.

---

<div class="post-metadata">

**Author:** ![csaba911](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/csaba911/32/3378_2.png) [@csaba911](https://forum.djangoproject.com/u/csaba911)\
**Post date:** [April 14, 2022, 2:11am UTC](https://forum.djangoproject.com/t/modelform-json-to-chekbox/13131/3 "2022-04-14T02:11:21Z")

</div>

Thanks Ken

Working on it, not a huge fan of using plugins what I don’t know so I’m make something up as I go.

```auto
args["certification_json"] = json.dumps(job.certification)
return render(request, 'jobsite/view_job.html', args)

```

than using some JavaScript to manipulate the dev class
