python - Django models.Model superclass -



python - Django models.Model superclass -

i create models.model class doesn't became part of database interface other models (i want avoid repeating code).

something that:

class interface(models.model): = models.integerfield() b = models.textfield() class foo(interface): c = models.integerfield() class bar(interface): d = models.charfield(max_length='255')

so database should have foo (with a,b,c collumns) , bar (with a,b,d) not table interface.

"abstract base of operations classes"

abstract base of operations classes useful when want set mutual info number of other models. write base of operations class , set abstract=true in meta class. model not used create database table. instead, when used base of operations class other models, fields added of kid class.

python django

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -