On Mon, 2009-03-09 at 03:54 -0700, guptha wrote:
> hi gp,
> In models.py
> 
>       class BankerCategory(models.Model):
>               name = models.CharField(max_length=125,unique=True)
> 
>       class Banker(models.Model):
>                 bankercategory = models.ForeignKey(BankerCategory)
> 
>       class Homeloan(models.Model):
>                 banker = models.ForeignKey(Banker)
> 
> 
> I need to retrieve 'name' field of 'BankerCategory' with 'Homeloan'
> object
>        home=Homeloan.objects.all()
>     from this 'home' object how can i access value of 'name' field of
> 'BankerCategory'

Each Homeloan intsance has a "banker" attribute. You just access it to
refer to the related object. See
http://docs.djangoproject.com/en/dev/topics/db/queries/#related-objects
for all the details.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to