Thank you for your quick answer.
It works fine now.
On 24 avr, 10:13, "wrzymar Gazeta.pl" <wrzy...@gazeta.pl> wrote:
> Hello,
>
> Add co class Town function __unicode__
>
> class Town(models.Model):
> id_town = models.AutoField(primary_key=True)
> name = models.CharField(max_length=30)
>
> def __unicode__(self):
> return self.name
>
> 2009/4/24 gontran <geoffroydecorb...@gmail.com>
>
>
>
>
>
> > Hello,
>
> > I have a problem with a select in a ModelForm.
>
> > My model:
> > class Person(models.Model):
> > first_name = models.CharField(max_length=30)
> > last_name = models.CharField(max_length=30)
> > id_town = foreignyKey(Town)
>
> > class Town(models.Model):
> > id_town = models.AutoField(primary_key=True)
> > name = models.CharField(max_length=30)
>
> > Then I create a form:
> > class PersonForm(ModelForm):
> > class Meta:
> > model = Person
>
> > When I use it, in the select for selectionning the town, I have "Town
> > object" but I would like to have the town name.
>
> > Any idea to fix the problem?
>
> > Thank you for your consideration.
>
> > Geoffroy
>
> --
> Pozdrawiam,
> Marcin Wrzyciel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---