FieldTracker raises AttributeError for __delete__ when attempting to refresh a model field
acardnell-intruder opened this issue · 0 comments
acardnell-intruder commented
Problem
According to the Django documentation, you should be able to refresh a model field with the following syntax:
>>> obj = MyModel.objects.first()
>>> del obj.field
>>> obj.field # Loads the field from the database
However, models that have a FieldTracker
assigned will raise an AttributeError
for __delete__
instead.
As workaround you can refresh the instance with:
>>>obj.refresh_from_db(fields=['field_name'])
Environment
- Django Model Utils version: 4.2.0
- Django version: 3.2.13
- Python version: 3.10.4