# Access BoundField value in Django template for custom widget rendering

**URL:** <https://forum.djangoproject.com/t/access-boundfield-value-in-django-template-for-custom-widget-rendering/22503>\
**Category:** Templates & Frontend\
**Created:** [July 23, 2023, 1:16pm UTC](https://forum.djangoproject.com/t/access-boundfield-value-in-django-template-for-custom-widget-rendering/22503 "2023-07-23T13:16:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oneflydown](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/oneflydown/32/9123_2.png) [@oneflydown](https://forum.djangoproject.com/u/oneflydown)\
**Post date:** [July 23, 2023, 1:16pm UTC](https://forum.djangoproject.com/t/access-boundfield-value-in-django-template-for-custom-widget-rendering/22503/1 "2023-07-23T13:16:59Z")

</div>

I have a custom checkbox render in Django template. If there are any non\_field\_errors on form submission, when the form is rendered back with submitted values, how do I access the checked state of checkbox in Django template?

To illustrate:  
Checkbox from `{{ form.field }}` is rendering checked state correctly, where as

Checkbox using \<input type=“checkbox”…\> tag is not showing the checked state.

 ![Screenshot from 2023-07-23 18-40-01](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/b/b5236a2433812d03ef05bef24112be0deb3c757b.png)

Thanks  
~

---

<div class="post-metadata">

**Author:** ![oneflydown](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/oneflydown/32/9123_2.png) [@oneflydown](https://forum.djangoproject.com/u/oneflydown)\
**Post date:** [July 24, 2023, 3:21pm UTC](https://forum.djangoproject.com/t/access-boundfield-value-in-django-template-for-custom-widget-rendering/22503/2 "2023-07-24T15:21:36Z")

</div>

Implement the `render` method with custom template and its working.

```auto
    def render(self, name, value, attrs=None, renderer=None):
        context = self.get_context(name, value, attrs)
        template = loader.get_template(self.template_name).render(context)
        return mark_safe(template)

```
