I have landed into quite a unique problem. I created the model 1.'message', used it for a while, then i changed it to 2. 'messages' and after that again changed it back to 3. 'message' but this time with many changes in the model fields.
As i got to know afterwards, django migrations gets into some problems while renaming models. In my migrations, some problems have arose. Although I had run all migrations in the right way, while running the 3rd migration for message, i faced few problems that i fixed manually. Now when i ran migration for changes in other models, i found that this migration is still dependent on the 2nd migration of the messages. However, the fields for which it was dependent on the 2nd migration were actually created in third migration.
The traceback i am getting:
ValueError: Lookup failed for model referenced by field activities.Enquiry.message_fk: chat.Message
and:
Applying contacts.0002_mailsend...Traceback (most recent call last):
File "/home/sp/webapps/myenv/lib/python3.4/site-packages/django/apps/config.py", line 163, in get_model
return self.models[model_name.lower()]
KeyError: 'message'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/sp/webapps/myenv/lib/python3.4/site-packages/django/db/migrations/state.py", line 84, in render
model = self.apps.get_model(lookup_model[0], lookup_model[1])
File "/home/sp/webapps/myenv/lib/python3.4/site-packages/django/apps/registry.py", line 202, in get_model
return self.get_app_config(app_label).get_model(model_name.lower())
File "/home/sp/webapps/myenv/lib/python3.4/site-packages/django/apps/config.py", line 166, in get_model
"App '%s' doesn't have a '%s' model." % (self.label, model_name))
LookupError: App 'chat' doesn't have a 'message' model.
What i want to ask is whether I should manually edit the dependencies in the migration file to change it from migration 2 to migration 3 in messages.
PS: using django 1.7.2