On Sat, 06 Mar 2010 23:39:59 +0200, Arkeoloji.web.tr wrote: > Hi all, > I have some ModelForms.. This ModelForms based some ForeignKey included > models. When i want to create a ModelForm I got these ForeignKey fields > something like (in a dropdown menu) "BlaBla object". But i want to get > in that dropdown menus something like "Linus Torvalds". I mean how can I > show in that fields that Models name area or adress area? > I made my ModelForm like that : > > class Author(models.Model): > name = models.ForeignKey(User) > status = models.CharField(max_length=30) > > > class AuthorForm(ModelForm): > class Meta: > model = Author > exclude = ("status",) > > -- > http://www.arkeoloji.web.tr
Hello, Try giving your models a __unicode__ method, so that you can manage how they are displayed. For example: class Author(models.Model): name = models.ForeignKey(User) status = models.CharField(max_length=30) def __unicode__(self): return self.name Cheers, Kev -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.