我正在尝试获取用户列表以及平均登录时间
模型1:
class User(models.Model):
name = models.CharField(max_length=200)
age = models.CharField(max_length=200)
email = models.CharField(max_length=200)
模型2:
class History(models.Model):
login_time = models.DateTimeField()
logout_time = models.DateTimeField()
user = models.ForeignKeyField(User, related_name="user_relation")
我需要以下格式的列表中的记录avg_logged_in_time将平均为(logout_time-登录时间)
Name, email, avg_logged_in_time