I get a model object, change an attribute, save it and it still has the old attribute:
>>> g = SiteProfile.objects.get(pk=3)
>>> g.renew_date
datetime.date(2010, 4, 11)
>>> g.renew_date = date.today()+timedelta(days=365)
>>> g.renew_date
datetime.date(2011, 4, 11)
>>> g.save()
>>> g.renew_date
datetime.datetime(2010, 4, 11, 16, 57, 4, 192684)
Anyone know if this is an issue with the database or something else?
I figured it out.
The issue was that the field
renew_datehad the argumentauto_nowset toTrueas such:I understood
auto_nowto mean that the current date will be used when creating the object, but it turns out that’s not the case:What I needed was
auto_now_addwhich:So, after changing my
renew_datefield:it all works, just fine 🙂