views:

54

answers:

1

Hi guy's , i have an app 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 :)

+1  A: 

You could try something similar to the technique I propose in the answer to this (my own) question: http://stackoverflow.com/questions/572263/how-do-i-create-a-django-form-that-displays-a-checkbox-label-to-the-right-of-the

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.

Ori Pessach