Django - change select items display
I use ModelForm. One of fields is: repertoire = models.ForeignKey(Repertoire) I need to change it's display type. Instead of using *unicode* in display I want to show name and date of repertoire. How in ModelForm I can do that? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/M4Lfow9YmGMJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django - change select items display
hi do you solved it ? I'm looking for the same and do not find anything to change which column is used in the SELECT instead of __unicode__ thanks jm Le mercredi 20 juillet 2011 00:16:06 UTC+2, galgal a écrit : > > I use ModelForm. One of fields is: > > repertoire = models.ForeignKey(Repertoire) > > I need to change it's display type. Instead of using *unicode* in display > I want to show name and date of repertoire. How in ModelForm I can do that? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/gbAncWxkSL4J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django - change select items display
27.8.2012 12:11, jm kirjoitti: hi do you solved it ? I'm looking for the same and do not find anything to change which column is used in the SELECT instead of __unicode__ thanks jm Le mercredi 20 juillet 2011 00:16:06 UTC+2, galgal a écrit : I use ModelForm. One of fields is: |repertoire= models.ForeignKey(Repertoire) | I need to change it's display type. Instead of using *unicode* in display I want to show name and date of repertoire. How in ModelForm I can do that? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/gbAncWxkSL4J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en. You can change it by creating custom field and overriding label_from_instance method. It's documented just below https://docs.djangoproject.com/en/1.3//ref/forms/fields/#django.forms.ModelChoiceField.empty_label HTH, -- Jani Tiainen - Well planned is half done and a half done has been sufficient before... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.