Changes between Initial Version and Version 1 of Ticket #28073, comment 15


Ignore:
Timestamp:
Nov 13, 2017, 4:08:50 PM (7 years ago)
Author:
Carel

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28073, comment 15

    initial v1  
    88The process fails at Step 3 where the field being removed triggers the error, `AttributeError: 'NoneType' object has no attribute 'is_relation'`. Originally I was using Django 1.11.3/4 but have bumped to 1.11.7 and have the same problem.
    99
    10 Based on the code posted by **PythonForce** it would seem that the loop is not assigning an instance to `old_field`, so where it tries to assign a value for `delay` it is breaking as there is no attribute `is_relation` for `None`/`NoneType`. Now it seems `delay` should be a boolean value so I would like to suggest one replace the line `delay = not old_field.is_relation` with `delay = old_field is None and not old_field.is_relation` then if `old_field` is `None` delay is `False` and the relation short circuits before testing the attribute. If `old_field` turns out to be an instance then `delay` depends upon `old_field.is_related`, as it presently does.
     10Based on the code posted by **PythonForce** it would seem that the loop is not assigning an instance to `old_field`, so where it tries to assign a value for `delay` it is breaking as there is no attribute `is_relation` for `None`/`NoneType`. Now it seems `delay` should be a boolean value so I would like to suggest one replace the line `delay = not old_field.is_relation` with `delay = old_field is not None and not old_field.is_relation` then if `old_field` is `None` delay is `False` and the relation short circuits before testing the attribute. If `old_field` turns out to be an instance then `delay` depends upon `old_field.is_related`, as it presently does.
    1111
    1212{{{
     
    2626}}}
    2727
    28 My suggestions is based upon only this snippet of code and I am not aware of any other context that may be relevant. I will try to pull down the sources and apply this. If successful I shall report back.
     28My suggestions is based upon only this snippet of code and I am not aware of any other context that may be relevant. I just tried this on the development branch and am now getting `django.core.exceptions.FieldDoesNotExist: Translatorcache has no field named 'lastModifiedTime'` which I can only assume is an improvement.
    2929
    3030P.s. If the manner in which I have posted does not meet some guideline, let me know I'll try to neaten it up or whatever as necessary.
Back to Top