Am Donnerstag, 24. Januar 2008 05:02 schrieb xunSir:
> class Person(models.Model):
>      PIN = models.CharField(maxlength=20, primary_key=True)
>      Name = models.CharField(maxlength=20)
>
> class Burse(models.Model):
>      PIN = models.ForeignKey(Person)
>      Cash = models.IntegerField()
> ===================
>  p = Person(......)
>  m = p._meta
>  m.get_all_related_objects()  Can get Burse !
> =====================
> Reverse That !
> How to get Person with Burse ?

I use this. Maybe there is a better solution:

Person.objects.filter(burse_set__isnull=False)

PS: You can get Burse from Person without 'get_all_related_objects()', too.
This method is just to improve/decrease performanace.

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to