How to ignore the migrations of django.contrib.auth?

0

I have a Django application where I want to customize the authentication part. I've already done my own Authentication backend as well as set up my own Model that will be used in authentication.

The problem is that when I run the command python manage.py showmigrations , the following migrations are appearing:

auth
 [ ] 0001_initial
 [ ] 0002_alter_permission_name_max_length
 [ ] 0003_alter_user_email_max_length
 [ ] 0004_alter_user_username_opts
 [ ] 0005_alter_user_last_login_null
 [ ] 0006_require_contenttypes_0002
 [ ] 0007_alter_validators_add_error_messages
 [ ] 0008_alter_user_username_max_length
 [ ] 0009_alter_user_last_name_max_length
contenttypes
 [ ] 0001_initial
 [ ] 0002_remove_content_type_name
sessions
 [ ] 0001_initial

How can I remove these migrations from auth in Django? I plan to use a custom layout and I do not want to let any new tables be created.

Note: My settings.py is set up as follows:

AUTHENTICATION_BACKENDS = ('app.backends.AuthBackend', )
AUTH_USER_MODEL = 'app.usuarios'
    
asked by anonymous 23.02.2018 / 12:57

1 answer

0

Before giving the migrate give the following command: python manage.py migrate auth --fake

Or just give the migrations you do not want to create

python manage.py migrate auth nome_da_migration --fake

But just as people have commented, be careful not to reinvent the wheel. For what you are doing can affect the installation of new libs, update of the django version, among other problems. The good practice in this case is to extend the default django classes and make the modifications you require.

    
11.03.2018 / 05:19