On May 7, 10:53 am, caio <elc...@gmail.com> wrote: > I have in my model something like this: > > class Person(models.Model): > field1 = ForeignKey(City) > field2 = models.TextField() > field3 = ForeignKey(Type) > photos = ImagingField() > photos_set = generic.GenericRelation(Image) > .... > > class City(models.Model): > name = CharField() > > class Type(models.Model): > value = CharField() > > Then I wanto to get in my template the value of Person.field1 but as > "name" not the "id". The same with field3, I want the "value" not the > "id". Maybe is a silly question, but doesn't work if I call > Person.field1.name. > > Finally, I also want to use in my template the first value of the > photos_set (in my previous email i refered to this as > "my_custom_set"). But again, I can specify this field as values() > method's parameter. > > Hope it explains better the situation. > Thanks, > Caio
Something is definitely wrong here if you can't do {{ person.field1.name }} in your template - assuming 'person' is an instance of the Person model. That should definitely work. Please can you post your view and template code showing this problem. -- DR. -- 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.