#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 <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.833073de0feca5e2e5905a5d672ef8f3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to