#32268: ProgrammingError: column doesnt exist when adding new field or removing 
a
field after makemigrations or migrate command
-------------------------------------+-------------------------------------
               Reporter:  gvm2121    |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:             |        Version:  2.2
  Migrations                         |       Keywords:  migrations,
               Severity:  Normal     |  makemigrations,ProgrammingError
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 This issues raises when you want to add or delete a field from a model and
 that model is used in a form before. We have here the egg-chicken problem.
 makemigrations parse the form (i do not why) and he detect changes on
 those fields and raise the error. (Bold fonts):
 I fixed that issue commenting or replacing all the lines with
 bases.objects.all() (the compromised model) by anything or an empty string
 on the form. After that i ran makemigrations again, migrate, re-composed
 fake lines on the forms and that was right.
 I think this issue could be on migrations documentation or be fixed. Also
 didnt found solutions on Django 3.
 Thanks very much.

 return _bootstrap._gcd_import(name[level:], package, level)
 File "<frozen importlib._bootstrap>", line 994, in _gcd_import
 File "<frozen importlib._bootstrap>", line 971, in _find_and_load
 File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
 File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
 File "<frozen importlib._bootstrap_external>", line 678, in exec_module
 File "<frozen importlib._bootstrap>", line 219, in
 _call_with_frames_removed
 File "/home/gvera/Fynsa/fynsa_src/fynsa/BASES/admin.py", line 3, in
 <module>
 '''from .formularios_bases import f_facturas_bases'''
 '''File "/home/gvera/Fynsa/fynsa_src/fynsa/BASES/formularios_bases.py",
 line 27, in <module>'''
 ''' class f_fechas_comite(forms.Form):'''
 '''File "/home/gvera/Fynsa/fynsa_src/fynsa/BASES/formularios_bases.py",
 line 29, in f_fechas_comite'''
 '''fecha_final = forms.DateField(widget=forms.DateInput(attrs={'class
 ':'form-control mx-2','type':'date'}),label='fecha final', required=True,
 initial=bases.objects.latest('fecha'))'''
 File "/home/gvera/Fynsa/fynsa_env/lib/python3.6/site-
 packages/django/db/models/manager.py", line 82, in manager_method
 return getattr(self.get_queryset(), name)(*args, **kwargs)
 File "/home/gvera/Fynsa/fynsa_env/lib/python3.6/site-
 packages/django/db/models/query.py", line 649, in latest

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32268>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.bfe1fec47c5d6effdd37362be089d91d%40djangoproject.com.

Reply via email to