DEV Community

Ashutosh Mishra
Ashutosh Mishra

Posted on

“message”: “expected string or bytes-like object”,

#i want the total time taken by a session to get completed,but i am getting the above mentioned error,What do i nedd to change

#MODEL

            class User(models.Model)
                user=models.CharField(max_length=40)

            class Sport(models.Model):

                Sports_Name=models.CharField(max_length=30,null=True,blank=True)

            class Session(models.Model):

                Host=models.ForeignKey(MyUser,on_delete=models.CASCADE,related_name='host')
                sports=models.ForeignKey(Sport,on_delete=models.CASCADE)
                Start_time=models.TimeField(auto_now=False, auto_now_add=False,null=True)
                End_time=models.TimeField(auto_now=False, auto_now_add=False,null=True)

            class Gamification(models.Model):

                User_Name=models.ForeignKey(MyUser,on_delete=models.CASCADE)

            #viewset
            users=Gamification.objects.all()

            b=[]
            for user in users:
                                
            b.append({

Top comments (0)