Hey Adi your answer saved me lots of work, but i want to elaborate on it, i
had this use case but i didnt have to subclass the field all i did was
defined a new label_from_instance
def Option_with_specie(self):
return mark_safe(" %s
"%(self.species.name, self.pk, self.name))
And then on t
I was able to find the solution to it myself.
The key was to
1. Create a custom field that extended ModelChoiceField.
2. Overwrite the label_from_instance method in the custom field.
3. Return a HTML string from the label_from_instance method, and
marking that as a safe_string.
from django.forms
Hi I have a situation like this
class AppearanceThemesForm(forms.Form):
page_theme =
forms.ModelChoiceField(widget=forms.RadioSelect(attrs={'title':'Select
the appropriate theme for your pages.'}),
queryset=Theme.objects.filter(section="1"),
initial=Theme.objects.get(section="1",representa
3 matches
Mail list logo