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 th

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 = models.Positive

having some validation logic in abstract class

2012-11-23 Thread Emmanuel Jannetti
Hi all, The question is how to add some validation statement in an upper/abstract class against all instances of subclasses. here is the model *class UpperAbstract(models.Model):* * * * def verifyUnique(value):* *if value:* * len(UpperAbstract.objects.filter(myuniquefield=value)) > 0

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

Re: missing column name in subclasses

2012-11-20 Thread Emmanuel Jannetti
Hi, If you drop the database (or just 'devLab_subfoo') and re-create it > dropping the DB did the trick Just found out that 'python manage.py flush --noinput ' followed by 'manage.py syncdb' is not enough. > (re-run syncdb) does the error persist? > > Looking at the generated SQL, it l

missing column name in subclasses

2012-11-20 Thread Emmanuel Jannetti
Hi, Using django 1.3.1 with SQLlight backend. I want to use the following kind of model. *class Bar(models.Model): a = models.PositiveSmallIntegerField(default=1) class Foo(models.Model): mybar = models.ForeignKey(Bar,blank=False,null=True,on_delete=models.CASCADE) class Meta: a