python - Django model derived class -
i' ve django model fields , methods this:
class follow(models.model): fields = ... def methods(self, ...): ...
. i' d create model same fields , methods, in new model i' d have new fields , methods well, this:
class auto(follow): additionalfields = ... def additionalmethods(self, ...): ...
, in case problem if create auto object, it' ll appear in follow.objects.filter() queryset well. how workaround it? thought specify is_auto = models.booleanfield(default = ?) field in both of models relevant value, fails during schemamigration:
django.core.exceptions.fielderror: local field 'autob' in class 'auto' clashes field of similar name base of operations class 'follow'
. thought how workaround it?
class baseitem(models.model): #fields , methods class follow(baseitem): pass class auto(baseitem): #additional fields
python django
No comments:
Post a Comment