Hi Tom,

You might want to have a look at inheritanceCastModel from
django-model-utils by Carl Meyer
http://github.com/carljm/django-model-utils

Best regards,
Miguel Araujo

2010/10/29 David De La Harpe Golden <david.delaharpe.gol...@ichec.ie>

> On 29/10/10 00:04, Tom Eastman wrote:
>
>  That's correct, but I want to take a 'Place' object, that doesn't have a
>> 'restaurant', and turn it *in to* a 'Restaurant' by adding the
>> corresponding row to the Restaurant table.
>>
>
>
> So you have a place.
>
> p = Place(name="3rd Circle of Hell")
> p.save()
>
> This should work:
>
> r = Restaurant(serves_hot_dogs=True)
> r.place_ptr = p
> r.save()
>
> If you then want an r that has picked up the now-should-be-inherited place
> attrs, you'll have to do something like:
>
> r = Restaurant.objects.get(pk=r.pk)
>
> print r.name
> 3rd Circle of Hell
>
>
>
> --
> 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<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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

Reply via email to