[Django]-Django makemigrations makes new migration files for unchanged model fields

4👍

You get the duplicate entries because you are appending to the same list each time the field is initialized. It would be better to use the default_validators attribute, as used in the docs. You can then remove your __init__ method.

class JsonField(models.TextField):
    default_validators = [validators.validate_slug]

Hopefully that will solve the migration issue as well. You might need to create one final migration before it stops changing (or recreate the previous migration that added the json fields).

Leave a comment