S
S
Stanislav Fateev2015-08-04 10:40:10
Django
Stanislav Fateev, 2015-08-04 10:40:10

Django, mixins and migrations. What's wrong?

makemigrations does not pick up the history field from the mixin, returns No changes detected - accordingly, the field does not appear in the model. If you do without a mixin, then everything is OK. CHADNT?

from django.db import models
from simple_history.models import HistoricalRecords

class Historycal(models.Model):
    history = HistoricalRecords()

    class Meta:
        abstract = True

class Manufacturer(Historycal):
    name = models.CharField(max_length=255)
    website = models.URLField()

    class Meta:
        ordering = ["name"]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2015-08-04
@svfat

The meta also needs to be inherited if you override it.
https://docs.djangoproject.com/en/1.7/topics/db/mo...
UPD.
By the way, it is completely unclear what kind of HistoricalRecords you have. Maybe it doesn't inherit from Field at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question