Django 2.1 creates autotable

Question:

I’m pretty new at Django 2.1 framework.
and I am a week trying to setup the tables for my app. Settings are fine I listed my app in INSTALLED_APPS, but when I try to run manage.py migrate code it gives me one auto_table instead of the ones that was written on model file.

These are my models.

Models.py

from django.db import models


class Nome (models.Model):
    titulo = models.CharField(max_length=100),
    objetivo = models.CharField(max_length=100),


class Sobrenome (models.Model):
    lets = models.ForeignKey(Nome, on_delete=models.CASCADE),
    make = models.CharField(max_length=100),

That’s what migrate code gave to me:

from django.db import migrations, models

class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
    migrations.CreateModel(
        name='Dreams',
        fields=[
            ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
        ],
    ),
    migrations.CreateModel(
        name='Wish',
        fields=[
            ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
        ],
    ),
]
Asked By: lucasrf27

||

Answers:

The problem is that you have ended each line in your models definitions with a comma. This makes each attribute a tuple, so it is not recognized as an actual field. Remove the commas:

class Nome (models.Model):
    titulo = models.CharField(max_length=100)
    objetivo = models.CharField(max_length=100)

and run makemigrations again.

Answered By: Daniel Roseman