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
To avoid unnecessary migrations You can do as follows:
Example:
from django.db import models
class CustomCharField(models.CharField): # or any other field
def deconstruct(self):
name, path, args, kwargs = super(CustomCharField, self).deconstruct()
# exclude all fields you dont want to cause migration, my example below:
if 'help_text' in kwargs:
del kwargs['help_text']
if 'verbose_name' in kwargs:
del kwargs['verbose_name']
return name, path, args, kwargs
Hope that helps