On Mon, Dec 20, 2010 at 8:29 PM, morgan wahl <morgy.w...@gmail.com> wrote:

> Hello all,
>
> I was wonder if there is a way to turn a model instance into an
> instance of a subclass of it's class. E.g.:
>
> class Document(models.Model):
>    doctype = models.CharField(max_length=256, blank=True, null=True)
>
> class UploadedFile(Document):
>    filename = models.CharField(max_length=256)
>
> Given a Document that isn't already an UploadedFile, can I turn it
> into one? I know at the database level it's just a matter of inserting
> a new row into the uploadedfile table with document_ptr_id = the
> Document's id. I've tried
>
>
I think that something like this should do the work:

Document.UploadFile.filename="rat.doc"
Document.save()


-- 
Marc

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