You need to specify the __unicode__ method of the model holding the Fish
object.
ie:
class FishHolder(models.Model):
name = models.CharField(...)
.....
def __unicode__(self):
return self.name
That should display the names instead of the ids.
Rgds,
Marcos
On Fri, Nov 19, 2010 at 3:34 PM, Jamie Pittock <[email protected]>wrote:
> I have to override the default display of a foreignkey field in a form
> and instead display it as a CharField. Currently it displays the
> selection's ID but I need to display the label instead
>
> To be clear, the select option would be the default display for the
> ForeignKey. At the moment after I've turned the display to a
> CharField it displays 23 in the field. I need to display Fish.
>
> <option value="23">Fish</option>
>
> Any help appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<django-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
--
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.
Jamie Zawinski, in comp.emacs.xemacs
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.