King
King

Reputation: 451

Django Model not accepting field

I created the following Model:

Everything worked fine, until I decided to add these two fields:

Metric_name_dv = models.CharField(_('Metric name dv'), max_length=200)
Defect_Area_Investigator_dv =  models.CharField(_('Defect Area Investigator'), max_length=200)

After adding these two fields and running makemigrations and migrate i kept on getting this error:

When looking at sqlite3, i dont see the fields: Metric_name_dv & Defect_Area_Investigator_dv:

What could I be missing? I tried to clear all past migrations and that didnt work, so i reset it back to normal.

Here is the views.py:

Upvotes: 1

Views: 352

Answers (2)

Srishti Ahuja
Srishti Ahuja

Reputation: 191

You might need to add a blank=true attribute or default value to the new columns. This could be a source of error.

Upvotes: 1

Francisco
Francisco

Reputation: 656

Try delete the file db.sqlite3 and then run the commands python manage.py makemigrations, python manage.py migrate

Upvotes: 1

Related Questions