2

I'm new django web framework. I have a models.py file where i given information about my entity fields, i ran the manage.py migrate command table generated i have alter the table manually without touch the models.py later I have run the python manage.py inspectdb > myapp/models.py in controller level using os.system models.py updated then i have tried models.objects.all() I'm unable to get the newly added field, I have called the view By using ajax call , after page refresh only new field name coming.

can you help how to get all field names with in the ajax response only with out page refresh. It would be grateful if you can help me

Note: I have checked in view level only with out page refresh first time only new column not came after page refresh it came

Thanks in advance...

I'm looking for cache in django

suresh
  • 45
  • 1
  • 7

1 Answers1

0

Before migrating, you need to create migrations.

If your DB is correctly configured, here you are (python3/python depending on version that you are using):

First: python3 manage.py makemigrations

Second: python3 manage.py migrate

makemigrations creates SQL queries, and migrate runs it. You can read more here: Django 1.8 - what's the difference between migrate and makemigrations?

Dolidod Teethtard
  • 553
  • 1
  • 7
  • 22
  • when we changes in models.py we required makemigations and migrate commands to make changes in Database, but here my requirement is i do manually changes in database table and my models.py file I'm able to updating after updating the models.py for the first request models.py treating as empty file. after refreshing it is reflecting – suresh Apr 04 '19 at 06:03