Hmmm... this seems to be a common issue... extending already existing
records
Would be nice if there were a way to create the child, specify the pk
and do a "save child only"

On Apr 30, 9:04 am, AmanKow <[EMAIL PROTECTED]> wrote:
> Assuming ACT is your class name:
>
> ct = #... get the content type instance to extend here,  or obtain the
> pk in whatever way
> ct_pk= ct.pk
> existing_ct_as_dict=ContentType.objects.get(pk=ct_pk).values()[0]
> act = ACT(**existing_ct_as_dict #, your extended keyword vars)
> act.save()
>
> You must fetch and set all the fields in the content type, if you save
> from the child, and you haven't set the fields other than the pk, they
> will be overwritten with default values
>
> On Apr 29, 11:46 pm, medhat <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > QS-rf in general and model inheritance in particular are really cool.
> > I have been waiting for them for a long time, thanks :-)
>
> > I am trying now to use them. And one question I have is the following:
> > for multi-table inheritance, (using the example from the
> > documentation,) let's say that we have a Place object, is there a way
> > to convert that object into a Restaurant object?
>
> > The case I am trying to do is have an "augmented" ContentType [ACT]
> > object that will inherit from ContentType but add some other stuff,
> > like icon, etc... but at the time when I try to create my ACT, the
> > ContentType object is already created by syncdb. So, is there a way to
> > create an ACT and tell it to use a specific ContentType object as its
> > parent? Or should this be done differently?
>
> > --
> > Thanks,
> > Medhat
>
> > P.S. Before model inheritance I did this using a OneToOneField, but I
> > am trying to take advantage of model inheritance now.
--~--~---------~--~----~------------~-------~--~----~
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