From 10d82c85aa5f8bd6adff0db49798dd368455cdcf Mon Sep 17 00:00:00 2001 From: Prabakaran Kumaresshan Date: Fri, 19 Oct 2018 12:26:33 +0530 Subject: Fixed #29831 -- Added validation for makemigrations --name. --- django/core/management/commands/makemigrations.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'django/core') diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py index ea90467d22..cdccb8e9b3 100644 --- a/django/core/management/commands/makemigrations.py +++ b/django/core/management/commands/makemigrations.py @@ -61,6 +61,8 @@ class Command(BaseCommand): self.merge = options['merge'] self.empty = options['empty'] self.migration_name = options['name'] + if self.migration_name and not self.migration_name.isidentifier(): + raise CommandError('The migration name must be a valid Python identifier.') check_changes = options['check_changes'] # Make sure the app they asked for exists -- cgit v1.3