#28073: RemoveField.state_forwards() crashes with AttributeError: 'NoneType' 
object
has no attribute 'is_relation'
---------------------------------+-------------------------------------
     Reporter:  Logan Gunthorpe  |                    Owner:  nobody
         Type:  Bug              |                   Status:  closed
    Component:  Migrations       |                  Version:  1.11
     Severity:  Normal           |               Resolution:  needsinfo
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+-------------------------------------

Comment (by Matthew Dennis):

 Ive managed to run into this as well on Django 1.11.

 I had merged 2 very diverged branches(git) which had conflicting
 migrations that couldn't be merged. I deleted 2 leaf migrations that had
 been made on the branch and was just going to run make migrate to create
 only the fields that were different. I guess you can't do that. Anyway
 long story short I never committed the merge and reset my head but this
 error persists even after the fact. I'm assuming its something to do with
 it thinking I'm at a point that I'm not/doesn't exist.

 I can't give you guys solid re-creation steps(and I don't know a lot about
 migrations) to get to this point so I'm not asking for a fix here.
 But if you're setting a variable to None and then populating it
 conditionally in a loop it shouldn't be assumed it will have a value once
 the loop is complete. I'm suggesting an assert or some sort of exception
 handling for this. Perhaps with a message suggesting they report their
 steps to create this scenario on here.

 Seeing as the comment above implies that `old_field is None or ...` would
 be a valid solution I don't see why you wouldn't just put that in. Adding
 that to my local file allows me to proceed but because I don't know whats
 causing this I can't merge this branch for fear of breaking it for others.

 Thanks

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28073#comment:7>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.d8b074379e598167120c0033ad5acb69%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to