Does the south contain model mixes?

I created mixin and inherited it in some models. The problem is that when I create a schema migration, there are mixin fields.

class MyMixin(object): a_field = models.CharField(max_length=30, blank=True) another_field = models.DateTimeField(blank=True, null=True) class Meta: abstract = True class MyModel(models.Model, myMixin): ... 

Any ideas?

+4
django mixins django-south
Jun 27 '13 at 12:59 on
source share
1 answer

It seems to work using the following

 class MyMixin(models.Model): a_field = models.CharField(max_length=30, blank=True) another_field = models.DateTimeField(blank=True, null=True) class Meta: abstract = True class MyModel(myMixin, models.Model): ... 

Changes:

  • MyMixin inherits a model, not an object (despite many discussions around the site saying mixins for django should inherit an object, not a model)
  • inheritance order for MyModel - mixin should appear first
+5
Jun 27 '13 at 22:45
source share
— -



All Articles