开发者

Django RadioButtons with icons and not label?

i have an a开发者_C百科pp that have 2 fields: company_name and logo, i'm displaying the companies like radiobutton in my Form from Model, but i want to show the logo company 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

Thanks :)


You could try something similar to the technique I propose in the answer to this (my own) question: How do I create a Django form that displays a checkbox label to the right of the checkbox?

Instead of writing a filter that flips the markup around, you'll need to somehow get the filter to replace the labels with the appropriate images.

Admittedly, this sounds kinda awkward to work with.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜