3 massive problems related to django orm pls help!!!!

after adding new field to existing model in models.py , error shown for django.db.utils.OperationalError: no such column: new_field.

after adding second model in models.py, run successfully in localhost but crashed when running heroku run python manage.py migrate for heroku, error: django.db.utils.programmingerrors: relation new model does not exist.


how to extract and perform calculation of value extract from floatfield in a django model, said nonetype and decimal.Decimal not for calculation like x += 1.


got a field with auto now, use strftime on extracted value of the datatimefield works, but when it goes to heroku, it said nonetype does not have strftime

thx pls hellp help

For the new field and new relations - you didn’t make migrations or run them: https://docs.djangoproject.com/en/3.0/topics/migrations/

For the NoneType errors - this is because you have a None. If your field has null=True, it can contain None in Python. https://docs.djangoproject.com/en/3.0/ref/models/fields/#null . I think they’re both caused by this. When migrating you need to consider existing data :slight_smile:

1 Like