[Answer]-Display image as property of a ChoiceField in a form

1👍

To solve this problem you basically have three options:

  1. Create your own renderer, and use it as argument for ChoiceField, unfortunately you will need to create it from scratch, since django doesn’t allow you to simply override RadioFieldRenderer class. https://github.com/django/django/blob/1.5.4/django/forms/widgets.py#L693

  2. Just loop over your choices and use manually created radio input tags, there’s not a lot of validation to do and retrieving selected item or model object is also simple enough.

  3. The simplest and less recommended way could be to include the whole image tag inside label string (use settings to get media url part).

Leave a comment