Opened 7 years ago

Closed 7 years ago

#28615 closed Bug (invalid)

makemigrations doesn't generate any output for a model with CharField blank=False

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 Mikalai Radchuk)

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:

  1. 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)
  1. Run the makemigrations command. It will generate an initial migration file.
  2. Uncomment the authors field.
  3. Run the makemigrations command again. It will not generate a new migration file and will not give you any output. Exit code is 0.

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.

Change History (2)

comment:1 by Mikalai Radchuk, 7 years ago

Description: modified (diff)

comment:2 by Mikalai Radchuk, 7 years ago

Resolution: invalid
Status: newclosed

I'm sorry. I didn't mention that I was running makemigrations with --noinput. It returns exit code `3`, as documented.

I mentioned this in the ticket:

Exit code is 0.

It's a mistake.

Note: See TracTickets for help on using tickets.
Back to Top