Django: Handle migrations created in site-packages for a custom Group field

Viewed 33

I require a description field added to the django.contrib.auth.models.Group, so I used this solution (if there is a better way please let me know):

from django.contrib.auth.models import Group

Group.add_to_class('description', models.TextField(max_length=250, default=""))

Unfortunately this creates a migration in:

site-packages/django/contrib/auth/migrations/0013_group_description.py

This is the migration:

class Migration(migrations.Migration):

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.AddField(
            model_name='group',
            name='description',
            field=models.TextField(default='', max_length=250),
        ),
    ]

This can't be checked into source code since it's in the python site-packages location.

I managed to find the MIGRATION_MODULES setting, but unfortunately I don't wish to move all of the auth app's migration to a new dir (django comes with 12 migrations already for auth, and may ship more in the future.

No idea how to solve this problem. It really makes deployment a nightmare.

0 Answers
Related