On Monday, 17 September 2018 08:52:32 UTC+1, Joel wrote: > > Thank you. That is how I fixed it yesterday late night after spending > hours on it. > > For anyone else that may find it useful, > I had dropped the tables to fix this. But that ended complaining about > missing tables. Then I dropped the database, since all I had was > development data. > It wouldn't do the makemigrations, still complaining about missing > columns. I deleted migration files, pycache.. Nothing helped. > Finally, I commented imports of models and forms in my code, and then ran > python3 manage.py app makemigrations > And then it worked. >
Note that although this may have fixed the immediate problem, you still have another issue, which as Michal pointed out is that you are doing database queries at class level in your forms. This will hurt you in several ways: you'll get the same problem when you try to deploy to production, and more seriously you are causing the form to only get the list of doctors on first import. If you add a new doctor you won't see it until you restart the web server process. If you must generate choices like this, do it in the form's `__init__` method, but generally it is better to use ModelChoiceField with a queryset rather than a ChoiceField with a manually-generated list of choices. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1d0f466f-076b-4964-b54c-09a908fd04c8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.