Advertisement
MartinYanchev-99

models.py

Mar 26th, 2021
1,064
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. from django.db import models
  2. from django.contrib.auth.models import User
  3. from datetime import datetime
  4. import pytz
  5. # Create your models here.
  6. class Sleep(models.Model):
  7.     user = models.ForeignKey(User,on_delete=models.CASCADE)
  8.     start = models.DateTimeField(default=datetime.now())
  9.     end = models.DateTimeField(default=datetime.now())
  10.  
  11.     def __str__(self):
  12.         return f'{self.user.username} - {self.start}/{self.end}'
  13.  
  14.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement