Re: turning a Model instance into an instance of one of it's subclasses

2010-12-21 Thread Morgan Wahl
2010/12/20 Łukasz Rekucki : > On 21 December 2010 00:18, Morgan Wahl wrote: >> Actually, it's funny you mention #7623; my situation _is_ described in >> #11618 ( http://code.djangoproject.com/ticket/11618 ). That bug was >> marked as a dup of #7623, but in my opinion isn't. > > It is a duplicate,

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-21 Thread Torsten Bronger
Hallöchen! Russell Keith-Magee writes: > On Tue, Dec 21, 2010 at 8:33 PM, Torsten Bronger > wrote: >> Hallöchen! >> >> Marc Aymerich writes: >> >>> [...] >>> >>> Morgan, take a look at the inheritanceManager of this app: >>> https://github.com/carljm/django-model-utils#readme >> >> Is anything l

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-21 Thread Russell Keith-Magee
On Tue, Dec 21, 2010 at 8:33 PM, Torsten Bronger wrote: > Hallöchen! > > Marc Aymerich writes: > >> [...] >> >> Morgan, take a look at the inheritanceManager of this app: >> https://github.com/carljm/django-model-utils#readme > > Is anything like this planned for core Django?  It's the third or >

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-21 Thread Torsten Bronger
Hallöchen! Marc Aymerich writes: > [...] > > Morgan, take a look at the inheritanceManager of this app: > https://github.com/carljm/django-model-utils#readme Is anything like this planned for core Django? It's the third or forth time I see someone needing it. Tschö, Torsten. -- Torsten Brong

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Łukasz Rekucki
On 21 December 2010 00:18, Morgan Wahl wrote: > Actually, it's funny you mention #7623; my situation _is_ described in > #11618 ( http://code.djangoproject.com/ticket/11618 ). That bug was > marked as a dup of #7623, but in my opinion isn't. It is a duplicate, that's why I mentioned #7623 which i

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Morgan Wahl
Actually, it's funny you mention #7623; my situation _is_ described in #11618 ( http://code.djangoproject.com/ticket/11618 ). That bug was marked as a dup of #7623, but in my opinion isn't. 2010/12/20 Łukasz Rekucki : > This looks a lot like this bug: http://code.djangoproject.com/ticket/7623. > >

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Andrejus
Sent from my mobile device On Dec 20, 2010 8:04 PM, "morgan wahl" 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=Tr

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Morgan Wahl
That bug is slightly different; it concerns having _more than one_ entry in subclass(es)'s tables refer to the _same_ entry in the superclass's (which pretty much breaks the analogy with class inheritance, if you ask me). My situation is that I have various instances of Document, some of which are

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Morgan Wahl
> > Morgan, take a look at the inheritanceManager of this > app: https://github.com/carljm/django-model-utils#readme > -- > Marc > I'm not sure how InheritanceManager would quite solve _this_ problem, although it certainly is handy (I've independently implemented something like InheritanceCastMode

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Łukasz Rekucki
This looks a lot like this bug: http://code.djangoproject.com/ticket/7623. On 20 December 2010 23:14, morgan wahl wrote: > Yes, I had hope that would work, but it doesn't (see my original post). In > your example u.doctype would end up as None instead of 'whatever'. > > -- > You received this mes

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread morgan wahl
ah, yes you beat me to it while I was composing my post below... Thanks! On Dec 20, 5:34 pm, Marc Aymerich wrote: > On Mon, Dec 20, 2010 at 11:14 PM, morgan wahl wrote: > > Yes, I had hope that would work, but it doesn't (see my original post). In > > your example u.doctype would end up as None

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Marc Aymerich
On Mon, Dec 20, 2010 at 11:34 PM, Marc Aymerich wrote: > > > On Mon, Dec 20, 2010 at 11:14 PM, morgan wahl wrote: > >> Yes, I had hope that would work, but it doesn't (see my original post). In >> your example u.doctype would end up as None instead of 'whatever'. > > > woww, I really need go to s

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread morgan wahl
Hmmm, I seem to have somewhat figured out what's going on. Using Marc's example, when you instantiate u it's doctype field is set to the default for Documents (None), since it isn't passed in. Then when you save it, it overwrites the field in d. So it seems the answer to my question is something

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Marc Aymerich
On Mon, Dec 20, 2010 at 11:14 PM, morgan wahl wrote: > Yes, I had hope that would work, but it doesn't (see my original post). In > your example u.doctype would end up as None instead of 'whatever'. woww, I really need go to sleep :) I don't know the best way to achieve that, btw you can pass

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread morgan wahl
Yes, I had hoped that would work, but it doesn't (see my original post). In your example u.doctype would end up as None instead of 'whatever' (however, u.document_ptr is d). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread morgan wahl
Yes, I had hope that would work, but it doesn't (see my original post). In your example u.doctype would end up as None instead of 'whatever'. -- 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...@goog

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Marc Aymerich
On Mon, Dec 20, 2010 at 11:00 PM, Morgan Wahl wrote: > On Mon, Dec 20, 2010 at 4:49 PM, Marc Aymerich > wrote: > > > > > > On Mon, Dec 20, 2010 at 8:29 PM, morgan wahl > wrote: > >> > >> Hello all, > >> > >> I was wonder if there is a way to turn a model instance into an > >> instance of a subc

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Morgan Wahl
On Mon, Dec 20, 2010 at 4:49 PM, Marc Aymerich wrote: > > > On Mon, Dec 20, 2010 at 8:29 PM, morgan wahl 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 =

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Marc Aymerich
On Mon, Dec 20, 2010 at 8:29 PM, morgan wahl 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 Upl