Django RadioButtons with icons and no shortcut?

I have an application that has 2 fields: company_name and logo, I show companies like radobutton in my Form from the Model, but I want to show the company of the logo instead of the company label (company name)

Any idea?

My forms:

class RecargaForm(ModelForm):
    compania = forms.ModelChoiceField(queryset=Compania.objects.all(), initial=0 ,empty_label='None', widget=forms.RadioSelect()) 

    class Meta:
        model = Recarga

Thank:)

+3
source share
1 answer

You can try something similar to the technique that I propose in answering this (my own) question: How to create a Django form that displays a check mark to the right of the check box?

Instead of writing a filter that reverses the markup, you need to somehow make the filter replace the labels with the appropriate images.

, .

+1

Source: https://habr.com/ru/post/1745594/


All Articles