prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Replace smart_text() with smart_str()
  To suppress warning: `RemovedInDjango40Warning: smart_text() is deprecated in favor of smart_str()`
  
  Run command `runserver`, find out the warning messages from output.
  
  </issue>
  <code>
  [start of src/tcms/logs/views.py]
  1 # -*- coding: utf-8 -*-
  2 
  3 from django.conf import settings
  4 from django.contrib.contenttypes.models import ContentType
  5 
  6 from .models import TCMSLogModel
  7 
  8 from django.utils.encoding import smart_text as smart_unicode
  9 
  10 
  11 class TCMSLog:
  12     """TCMS Log"""
  13 
  14     def __init__(self, model):
  15         super().__init__()
  16         self.model = model
  17 
  18     def get_new_log_object(self):
  19         elements = ['who', 'field', 'original_value', 'new_value']
  20 
  21         for element in elements:
  22             if not hasattr(self, element):
  23                 raise NotImplementedError(
  24                     f'Log does not have attribute {element}')
  25 
  26         model = self.get_log_model()
  27         new = model(**self.get_log_create_data())
  28 
  29         return new
  30 
  31     def get_log_model(self):
  32         """
  33         Get the log model to create with this class.
  34         """
  35         return TCMSLogModel
  36 
  37     def get_log_create_data(self):
  38         return {
  39             'content_object': self.model,
  40             'site_id': settings.SITE_ID,
  41             'who': self.who,
  42             'field': self.field,
  43             'original_value': self.original_value,
  44             'new_value': self.new_value,
  45         }
  46 
  47     def make(self, who, new_value, field=None, original_value=None):
  48         """Create new log"""
  49         self.who = who
  50         self.field = field or ''
  51         self.original_value = original_value or ''
  52         self.new_value = new_value
  53 
  54         model = self.get_new_log_object()
  55         model.save()
  56 
  57     def lookup_content_type(self):
  58         return ContentType.objects.get_for_model(self.model)
  59 
  60     def get_query_set(self):
  61         ctype = self.lookup_content_type()
  62         model = self.get_log_model()
  63 
  64         qs = model.objects.filter(content_type=ctype,
  65                                   object_pk=smart_unicode(self.model.pk),
  66                                   site=settings.SITE_ID)
  67         qs = qs.select_related('who')
  68         return qs
  69 
  70     def list(self):
  71         """List the logs"""
  72         return self.get_query_set().all()
  73
  [end of src/tcms/logs/views.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/tcms/logs/views.py b/src/tcms/logs/views.py
  --- a/src/tcms/logs/views.py
  +++ b/src/tcms/logs/views.py
  @@ -5,7 +5,7 @@
   
   from .models import TCMSLogModel
   
  -from django.utils.encoding import smart_text as smart_unicode
  +from django.utils.encoding import smart_str
   
   
   class TCMSLog:
  @@ -62,7 +62,7 @@
           model = self.get_log_model()
   
           qs = model.objects.filter(content_type=ctype,
  -                                  object_pk=smart_unicode(self.model.pk),
  +                                  object_pk=smart_str(self.model.pk),
                                     site=settings.SITE_ID)
           qs = qs.select_related('who')
           return qs
  
verification_info: {"golden_diff": "diff --git a/src/tcms/logs/views.py b/src/tcms/logs/views.py\n--- a/src/tcms/logs/views.py\n+++ b/src/tcms/logs/views.py\n@@ -5,7 +5,7 @@\n \n from .models import TCMSLogModel\n \n-from django.utils.encoding import smart_text as smart_unicode\n+from django.utils.encoding import smart_str\n \n \n class TCMSLog:\n@@ -62,7 +62,7 @@\n         model = self.get_log_model()\n \n         qs = model.objects.filter(content_type=ctype,\n-                                  object_pk=smart_unicode(self.model.pk),\n+                                  object_pk=smart_str(self.model.pk),\n                                   site=settings.SITE_ID)\n         qs = qs.select_related('who')\n         return qs\n", "issue": "Replace smart_text() with smart_str()\nTo suppress warning: `RemovedInDjango40Warning: smart_text() is deprecated in favor of smart_str()`\r\n\r\nRun command `runserver`, find out the warning messages from output.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\nfrom django.conf import settings\nfrom django.contrib.contenttypes.models import ContentType\n\nfrom .models import TCMSLogModel\n\nfrom django.utils.encoding import smart_text as smart_unicode\n\n\nclass TCMSLog:\n    \"\"\"TCMS Log\"\"\"\n\n    def __init__(self, model):\n        super().__init__()\n        self.model = model\n\n    def get_new_log_object(self):\n        elements = ['who', 'field', 'original_value', 'new_value']\n\n        for element in elements:\n            if not hasattr(self, element):\n                raise NotImplementedError(\n                    f'Log does not have attribute {element}')\n\n        model = self.get_log_model()\n        new = model(**self.get_log_create_data())\n\n        return new\n\n    def get_log_model(self):\n        \"\"\"\n        Get the log model to create with this class.\n        \"\"\"\n        return TCMSLogModel\n\n    def get_log_create_data(self):\n        return {\n            'content_object': self.model,\n            'site_id': settings.SITE_ID,\n            'who': self.who,\n            'field': self.field,\n            'original_value': self.original_value,\n            'new_value': self.new_value,\n        }\n\n    def make(self, who, new_value, field=None, original_value=None):\n        \"\"\"Create new log\"\"\"\n        self.who = who\n        self.field = field or ''\n        self.original_value = original_value or ''\n        self.new_value = new_value\n\n        model = self.get_new_log_object()\n        model.save()\n\n    def lookup_content_type(self):\n        return ContentType.objects.get_for_model(self.model)\n\n    def get_query_set(self):\n        ctype = self.lookup_content_type()\n        model = self.get_log_model()\n\n        qs = model.objects.filter(content_type=ctype,\n                                  object_pk=smart_unicode(self.model.pk),\n                                  site=settings.SITE_ID)\n        qs = qs.select_related('who')\n        return qs\n\n    def list(self):\n        \"\"\"List the logs\"\"\"\n        return self.get_query_set().all()\n", "path": "src/tcms/logs/views.py"}]}