#34382: DEFAULT_AUTO_FIELD ignored for new models
------------------------------------------+------------------------
               Reporter:  Alberto Donato  |          Owner:  nobody
                   Type:  Uncategorized   |         Status:  new
              Component:  Uncategorized   |        Version:  3.2
               Severity:  Normal          |       Keywords:
           Triage Stage:  Unreviewed      |      Has patch:  0
    Needs documentation:  0               |    Needs tests:  0
Patch needs improvement:  0               |  Easy pickings:  0
                  UI/UX:  0               |
------------------------------------------+------------------------
 Setting the value of `DEFAULT_AUTO_FIELD` to e.g. `AutoField` seems to be
 ignored when generating migrations for new models.

 A simple reproducer is to create a new project, change the setting as
 follows:

 {{{
 DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
 }}}

 and adding a simple model such as:

 {{{
 class SampleModel(models.Model):
     name = models.TextField(unique=True)
 }}}


 After running `./manage.py makemigrations` the following migration is
 generated:

 {{{
 class Migration(migrations.Migration):

     initial = True

     dependencies = [
     ]

     operations = [
         migrations.CreateModel(
             name='SampleModel',
             fields=[
                 ('id', models.BigAutoField(auto_created=True,
 primary_key=True, serialize=False, verbose_name='ID')),
                 ('name', models.TextField(unique=True)),
             ],
         ),
     ]
 }}}


 Same behavior can be reproduced both in 3.2 and 4.1.7.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34382>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070186a709028c-edc9ba1f-b961-499d-8a08-3fd024e84b73-000000%40eu-central-1.amazonses.com.

Reply via email to