Am Montag, 5. November 2007 18:47 schrieb Jeremy Dunck:
> Consider:
>
> class Place(Model):
>     ...
>
> class Retaurant(Model):
>     place = ForeignKey(Place, unique=True)
>     ....

You can use a property. Code not tested:

class Place(Model):
    def get_restaurant(self):
        try:
            return Restaurant.objects.get(place=self)
        except Restaurant.DoesNotExist:
            return None
    restaurant=property(get_restaurant)

 Thomas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to