[Django] #28615: makemigrations doesn't generate any output for a model with CharField blank=False

10 views
Skip to first unread message

Django

unread,
Sep 19, 2017, 5:21:39 AM9/19/17
to django-...@googlegroups.com
#28615: makemigrations doesn't generate any output for a model with CharField
blank=False
-------------------------------------+-------------------------------------
Reporter: Mikalai | Owner: nobody
Radchuk |
Type: Bug | Status: new
Component: Database | Version: 1.11
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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.

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)
}}}

2. Run the `makemigrations` command. It will generate an initial migration
file.
3. Uncomment the `authors` field.
4. 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/28615>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 19, 2017, 5:53:39 AM9/19/17
to django-...@googlegroups.com
#28615: makemigrations doesn't generate any output for a model with CharField
blank=False
-------------------------------------+-------------------------------------
Reporter: Mikalai Radchuk | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Mikalai Radchuk:

Old description:

> 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.
>
> 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)
> }}}
>
> 2. Run the `makemigrations` command. It will generate an initial
> migration file.
> 3. Uncomment the `authors` field.
> 4. 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.

New description:

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)
}}}

2. Run the `makemigrations` command. It will generate an initial migration
file.
3. Uncomment the `authors` field.
4. 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.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/28615#comment:1>

Django

unread,
Sep 19, 2017, 6:35:53 AM9/19/17
to django-...@googlegroups.com
#28615: makemigrations doesn't generate any output for a model with CharField
blank=False
-------------------------------------+-------------------------------------
Reporter: Mikalai Radchuk | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mikalai Radchuk):

* status: new => closed
* resolution: => invalid


Comment:

I'm sorry. I didn't mention that I was running `makemigrations` with
`--noinput`. [https://docs.djangoproject.com/en/1.11/ref/django-admin
/#cmdoption-makemigrations-noinput It returns exit code `3`, as
documented].

I mentioned this in the ticket:

> Exit code is 0.

It's a mistake.

--
Ticket URL: <https://code.djangoproject.com/ticket/28615#comment:2>

Reply all
Reply to author
Forward
0 new messages