diff options
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/migrations/autodetector.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py index b20946999f..41830f06ba 100644 --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -1154,6 +1154,7 @@ class MigrationAutodetector(object): Given a migration name, tries to extract a number from the beginning of it. If no number found, returns None. """ - if re.match(r"^\d+_", name): - return int(name.split("_")[0]) + match = re.match(r'^\d+', name) + if match: + return int(match.group()) return None |
