When I change help_text
or verbose_name
for any of my model fields and run python manage.py makemigrations
, it detects these changes a
You can squash it with the previous migration, sure.
Or if you don't want to output those migrations at all, you can override the makemigrations
and migrate
command by putting this in management/commands/makemigrations.py
in your app:
from django.core.management.commands.makemigrations import Command
from django.db import models
IGNORED_ATTRS = ['verbose_name', 'help_text', 'choices']
original_deconstruct = models.Field.deconstruct
def new_deconstruct(self):
name, path, args, kwargs = original_deconstruct(self)
for attr in IGNORED_ATTRS:
kwargs.pop(attr, None)
return name, path, args, kwargs
models.Field.deconstruct = new_deconstruct