You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Monitor field does not get updated while the creation of the model object even if matches the when condition
from model_utils.fields import MonitorField, StatusField
class Article(models.Model): STATUS = Choices('draft', 'published') status = StatusField() published_at = MonitorField(monitor='status', when=['published'])
Here whenever we create Article object with status = 'published', published_at does not get updated with timestamp.
BUT when we change status of an already existing Article from draft to published, published_at gets updated with timestamp value.
ie monitor field gets updated only when an object is updated, not when an object is created.
Environment
Django Model Utils version: 3.1.2
Django version: 2.2
Python version: 3.6 +
rpitonak, rustin-huang, dominiclauyf, vwallen and nad2000