Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.10/site-packages/django/core/checks/commands.py: 30%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

10 statements  

1from django.core.checks import Error, Tags, register 

2 

3 

4@register(Tags.commands) 

5def migrate_and_makemigrations_autodetector(**kwargs): 

6 from django.core.management import get_commands, load_command_class 

7 

8 commands = get_commands() 

9 

10 make_migrations = load_command_class(commands["makemigrations"], "makemigrations") 

11 migrate = load_command_class(commands["migrate"], "migrate") 

12 

13 if make_migrations.autodetector is not migrate.autodetector: 

14 return [ 

15 Error( 

16 "The migrate and makemigrations commands must have the same " 

17 "autodetector.", 

18 hint=( 

19 f"makemigrations.Command.autodetector is " 

20 f"{make_migrations.autodetector.__name__}, but " 

21 f"migrate.Command.autodetector is " 

22 f"{migrate.autodetector.__name__}." 

23 ), 

24 id="commands.E001", 

25 ) 

26 ] 

27 

28 return []