I have app in django 1.11 and I made migration. Now I have items in admin panel with 'John' in first_name
and 'Smith' in last_name
field. I would like to change it. Can I do this after made python manage.py migrate
?
operations = [
migrations.AddField(
model_name='downloadlink',
name='company',
field=models.CharField(default='Company', max_length=500),
preserve_default=False,
),
migrations.AddField(
model_name='downloadlink',
name='first_name',
field=models.CharField(default='John', max_length=500),
preserve_default=False,
),
migrations.AddField(
model_name='downloadlink',
name='last_name',
field=models.CharField(default='Smith', max_length=500),
preserve_default=False,
),
]
Just follow these steps,
Step1 . Revert all migartions of app by python manage.py migrate app_name zero
Step2 . Edit the migration file and save
Step3 . Migrate the database again by, python manage.py migarate app_name
Yes. You can make the changes in the admin console, which is usually accessed at localhost:8000/admin. You will have to click on the Model in the admin console and make the changes for the instance.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.