Re: Question about m2m and forms

2017-04-02 Thread Carlo Ascani
Il giorno sabato 18 febbraio 2017 11:02:25 UTC+1, Carlo Ascani ha scritto: > > > > Il giorno venerdì 17 febbraio 2017 20:09:15 UTC+1, Matthew Pava ha scritto: >> >> Hi Carlos, >> You probably want to create a new widget and override its >> label_from_instance method. >> >> class BModelMultiple

Re: Question about m2m and forms

2017-02-18 Thread Carlo Ascani
Il giorno venerdì 17 febbraio 2017 20:09:15 UTC+1, Matthew Pava ha scritto: > > Hi Carlos, > You probably want to create a new widget and override its > label_from_instance method. > > class BModelMultipleChoiceField(forms.ModelMultipleChoiceField): > def label_from_instance(self, obj

RE: Question about m2m and forms

2017-02-17 Thread Matthew Pava
Hi Carlos, You probably want to create a new widget and override its label_from_instance method. class BModelMultipleChoiceField(forms.ModelMultipleChoiceField): def label_from_instance(self, obj): return "%s (%s)" % (obj, obj.count_a) And then you'll want to change your