Home > other >  Django data migration, created migration file field is not complete, how to deal with
Django data migration, created migration file field is not complete, how to deal with

Time:05-12

Models. Py is created in the content of the
 
The from the django. Db import models
The from the django. Utils import timezone

# the Create your models here.


# upload excel file record
The class UploadExcelInfo (models. Model) :
Uei_create_time=models. DateTimeField (default=timezone. Now),
Uei_excel_old_name=models. CharField (max_length=100, null=False), # of the original excel name
Uei_excel_new_name=models. CharField (max_length=100, null=False), # new excel name
Uei_use_state=models. BooleanField (default=True), the contents of the # have generated the data, and saved into the database
Uei_is_complete=models. BooleanField (default=False), # import data are completed the False: do not complete True: have completed
Uei_is_delete=models. BooleanField (default=False), whether # delete
The class Meta:
Db_table='upload_excel_info_table'

0001 _initial. Py generated migration file
 
The from the django. Db import migrations, models


The class Migration (migrations. Migration) :

Initial=True

Dependencies=[
]

Operations=[
Migrations. CreateModel (
Name='UploadExcelInfo',
Fields=[
(' id 'models. AutoField (auto_created=True, primary_key=True, serialize=False, verbose_name="id")),
],
The options={
'db_table' : 'upload_excel_info_table',
},
),
]


Generate migration file, create a table after only one ID field, the other fields all have no, migration without any error,
I took several hours, also didn't find where is wrong, for help

CodePudding user response:

Models. Py don't add behind each field,
Uei_create_time=models. DateTimeField (default=timezone. Now),
Should be changed to
Uei_create_time=models. DateTimeField (default=timezone. Now)
Remove the comma is back to normal
  • Related