Thursday, October 28, 2010

Re: Model Inheritance.

Your "place" object will contain an attribute called "restaurant" to
access
the object as an instance of the subclass.

If this place object is an instance of another place subclass,
accessing the
restaurant attribute will raise a DoesNotExist error.

Carles.


On 28 Oct, 01:39, Tom Eastman <tom.east...@otago.ac.nz> wrote:
> I'm working with model inheritance, and I need to convert my objects
> into instances of its subclass.  Is there an easy way to do this?
>
> Looking at the example in:
>
> >http://docs.djangoproject.com/en/1.2/topics/db/models/#multi-table-in...
>
> I have a whole bunch of 'Place' objects that are in my database, and I
> want to turn them into 'Restaurant' objects.  How can I achieve this?
>
> (I want to end up with the implicit one-to-one relation in 'Restaurant'
> to be pointing to the already existing object in 'Place')
>
> Cheers!
>
>      Tom

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment