refresh_from_db is breaking on null foreign keys
— at Version 6
If i try to call refresh_from_db on a model instance that has a foreignkey set to null, i get an error:
(stacktrace was removed after ticket was resolved)
here rel_instance is assigned:
https://github.com/django/django/blob/stable/1.8.x/django/db/models/base.py#L630
if it is None (foreignkey not set, as it is nullable in this model) the getattr function will complain that it can not get 'id' from 'NoneType'
Change History
(7)
Severity: |
Normal → Release blocker
|
Triage Stage: |
Unreviewed → Accepted
|
Type: |
Uncategorized → Bug
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
Description: |
modified (diff)
|
Reproduced with the attached test.