In my previous blog post, Simulating time in Ruby on Rails framework, I described how to travel in time in both directions by using Ruby on Rails console. In this post I will describe same feature for Django framework.
Here is example how to update in django shell user table last_login column, using Django active record classes. User is filtered using email column.
cd to_root_of_your_django_project >python3 manage.py shell >> from sl_models import user >> user_instance = user.models.User.objects.filter(email="user_email value") >> user_instance.values() >> from datetime import timedelta >> from datetime import date >> user_instance.update(last_login=date.today() - timedelta(days=7)) //we are traveling by days, but it is also possible to travel by other time dimensions. Check python timedelta documentation >>user_instance.values()
I wish you happy time traveling in Django!