in "%s in %s" substitute '%s' with names string and app, respective, join all the previous pairs into a string separated by ';', substitute it for name_str. raise CommandError exception, with "Conflicting migrations detected (%s).\nTo fix them run 'python manage.py makemigrations --merge'",
raise CommandError ( "Conflicting migrations detected (%s).\nTo fix them run 'python manage.py makemigrations --merge'" % name_str )