title: Getting an error as "decoding to str: need a bytes-like object, int found" while tried to return id and field value in django models
body: <p><strong>model #1</strong></p>
  <pre><code>class Add_Job(models.Model):
      
      job_name=models.CharField(max_length=254)
      client=models.ForeignKey(Client,on_delete=CASCADE,related_name='client')
      #client=models.ManyToManyField(Client)
      project=models.ForeignKey(Project,on_delete=CASCADE,related_name='project')
      #project=models.ManyToManyField(Project)
      user=models.ForeignKey(Users,on_delete=CASCADE)
      Hours=models.TimeField(null=True)
      start_Date = models.DateTimeField(max_length=10)
      end_Date=models.DateTimeField(max_length=10)
      
      def __str__(self):
          return str(self.id, self.job_name)
  </code></pre>
  <p><strong>model #2</strong></p>
  <pre><code>class Add_Timelog(models.Model):
      
      
      project=models.ManyToManyField(Project)
      client=models.ManyToManyField(Client)
      Job=models.ManyToManyField(Add_Job)
      #Date = models.DateField(max_length=100 ,auto_now_add=True,editable=True)
      Date= models.DateField(default = datetime.date.today)
      Hours=models.TimeField(null=True)
      
      def __str__(self):
          return str(self.Date)
  </code></pre>
  <p>while I tried to return the 'id' and 'job_name' from the 'Add_Job' model it is getting reflected in the database table. But the 'Add_timelog' model is getting an error</p>
  <blockquote>
  <p>TypeError at /api/Add_Timelog/ decoding to str: need a bytes-like
  object, int found</p>
  </blockquote>
  <p>Don't know why it is getting an error.</p>
  <p>After update1:</p>
  <pre><code>class Add_Timelog(models.Model):
      
      
      project=models.ManyToManyField(Project)
      client=models.ManyToManyField(Client)
      Job=models.ManyToManyField(Add_Job)
      #Date = models.DateField(max_length=100 ,auto_now_add=True,editable=True)
      Date= models.DateField(default = datetime.date.today)
      Hours=models.TimeField(null=True)
      
      def __str__(self):
          return str( '{} {}'.format(self.Date, self.Hours))
  </code></pre>
  <p><strong>model 2</strong></p>
  <pre><code>class Consolidated(models.Model):
      
     emp_name=models.ManyToManyField(Users,related_name=&quot;employee_name+&quot;)
      proj_name=models.ManyToManyField(Project)
      custom_name=models.ManyToManyField(Client)
      Cons_date=models.ManyToManyField(Add_Timelog)
      bill_no_bill=models.ManyToManyField(Users,related_name=&quot;billable_and_non_billable+&quot;)
      hour_spent = models.ManyToManyField(Add_Timelog,related_name=&quot;hour_spent&quot;)
      
      def __str__(self):
         return str(self.emp_name)
  </code></pre>
  <p>So as per property method code it is returning the value as object and not as value. But I defined a str function and removed the property method and I am getting the value but both date and hours in the same field. But as per my model &quot;consolidated&quot;, I need to get that date seperately and hours seperately. Is that possible to do that in django model ?</p>