Re: overwrite field value in subclasses

2012-11-26 Thread Emmanuel Jannetti
Hi, checking on my side. All this works as soon as upper class are not abstract. regards manu On Monday, November 26, 2012 10:19:18 AM UTC+1, Emmanuel Jannetti wrote: > > Hi, > > Thank for the reply. > > Digging into _meta.fields of a created instance I see, as you said that * > myfield* is

Re: overwrite field value in subclasses

2012-11-26 Thread Emmanuel Jannetti
Hi, Thank for the reply. Digging into _meta.fields of a created instance I see, as you said that * myfield* is still defined as in the upper class. If I understood correctly your answer sub-class should have the field "redefine" instead of assigned . something like *myfield =

Re: overwrite field value in subclasses

2012-11-25 Thread Peter of the Norse
Foo.myfield is 0, but when you created a new models.Field object in the abstract class, it did some deep magic. There’s also Foo._meta.fields which has the old myfield in it. The only thing you can do is create a new myfield with default=0 and editable=False. On Nov 23, 2012, at 8:40 AM,

overwrite field value in subclasses

2012-11-23 Thread Emmanuel Jannetti
Hi all, One piece of my model is as follow : *class UpperAbstract(models.Model):* * CHOICE_A = 0* * CHOICE_B = 1* * **CHOICE_C = 2* * myfield = models.PositiveSmallIntegerField(choices=((CHOICE_A,'A'),(CHOICE_B,"B")** ,(CHOICE_C,"C")**),blank=False)* * class Meta:* * abstract = True* * *