changing field to local date

master
Matt Huntington 4 years ago
parent 0717ede9ec
commit 5da587e6b2

@ -5,7 +5,7 @@ class Session(models.Model):
seconds = models.IntegerField()
created_at = models.DateTimeField(auto_now_add=True)
def local_time(self):
def local_date(self):
local_date = self.created_at - timedelta(hours=4)
return local_date.strftime('%h %d, %Y at %I:%M:%S %p')

@ -4,5 +4,5 @@ from .models import Session
class SessionSerializer(serializers.ModelSerializer):
class Meta:
model = Session
fields = ('id', 'seconds', 'created_at', 'time_in_minutes', 'local_time',)
fields = ('id', 'seconds', 'created_at', 'time_in_minutes', 'local_date',)

Loading…
Cancel
Save