Opened 7 years ago
Last modified 7 years ago
#28615 closed Bug
makemigrations doesn't generate any output for a model with CharField blank=False — at Version 1
Reported by: | Mikalai Radchuk | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
It looks makemigrations
is unable to generate migrations for a model that contains CharField
with blank=False
or with default value (which is blank=False
).
I did manage to replicate it on Django 1.9, 1.10, 1.10.8, 1.11, 1.11.4, 1.11.5.
Python: 3.5.2, 3.6.1
The issue can be reproduced using the following steps:
- Create an app with
models.py
like this one:
from django.db import models class ExternalResourcePage(models.Model): # authors = models.CharField(max_length=256) publication_date = models.DateField() show_on_website = models.BooleanField(default=True)
- Run the
makemigrations
command. It will generate an initial migration file. - Uncomment the
authors
field. - Run the
makemigrations
command again. It will not generate a new migration file and will not give you any output. Exit code is0
.
makemigrations
works fine with authors = models.CharField(max_length=256, blank=True)
Expected result: makemigrations
creates a migration file or fails with a traceback in case of any exceptions.