prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Project list widget fails due to a date vs. datetime formatting error
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `akvo/rsr/templatetags/rsr_filters.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 """
  3 Akvo RSR is covered by the GNU Affero General Public License.
  4 
  5 See more details in the license.txt file located at the root folder of the Akvo RSR module.
  6 For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
  7 """
  8 
  9 import datetime
  10 import time
  11 
  12 from django import template
  13 from django.conf import settings
  14 from decimal import Decimal, ROUND_HALF_UP
  15 
  16 register = template.Library()
  17 
  18 DECIMAL_PLACES = getattr(settings, 'DECIMALS_DECIMAL_PLACES', 2)
  19 
  20 
  21 @register.filter
  22 def get_item(dictionary, key):
  23     """Enable lookup in dicts."""
  24     return dictionary.get(key)
  25 
  26 
  27 @register.filter
  28 def string_to_date(value):
  29     try:
  30         time_format = "%Y-%m-%d %H:%M:%S"
  31         fmt_time = time.strptime(value, time_format)
  32         return datetime.datetime(*fmt_time[:6])
  33     except:
  34         return value
  35 
  36 # http://stackoverflow.com/questions/250357/smart-truncate-in-python
  37 
  38 
  39 @register.filter("smart_truncate")
  40 def smart_truncate(content, length=100, suffix='...'):
  41     if len(content) <= length:
  42         return content
  43     else:
  44         return content[:length].rsplit(' ', 1)[0] + suffix
  45 
  46 
  47 @register.filter
  48 def round(value, decimal_places=DECIMAL_PLACES):
  49     try:
  50         value = Decimal(str(value))
  51     except:
  52         return u''
  53     if settings.DECIMALS_DEBUG:
  54         decimal_result = value.quantize(Decimal(10) ** -decimal_places)
  55         return decimal_result
  56     else:
  57         decimal_result = value.quantize(Decimal(10), ROUND_HALF_UP)
  58         return 0 if decimal_result <= 0 else decimal_result
  59 round.is_safe = True
  60 
  61 
  62 @register.filter
  63 def countries_list(obj):
  64     """ return a list of the countries of all locations of an object.
  65     currently works for Project and Organisation """
  66     return obj.locations.values_list('country__name', flat=True)
  67 
  68 
  69 @register.filter
  70 def continents_list(obj):
  71     """return a list of the continents of all locations of an object"
  72     currently works for Project and Organisation """
  73     return obj.locations.values_list('country__continent', flat=True)
  74 
  75 
  76 @register.filter
  77 def rsr_sorted_set(iterable):
  78     """ create a set of the iterable to eliminate duplicates
  79     then make a list of the set and sort it
  80     used with countries_list and continents_list
  81     """
  82     set_list = list(frozenset(iterable))
  83     set_list.sort()
  84     return set_list
  85 
  86 
  87 @register.filter
  88 def load_partnerships_and_orgs(project):
  89     return project.partnerships.prefetch_related('organisation').all()
  90
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/akvo/rsr/templatetags/rsr_filters.py b/akvo/rsr/templatetags/rsr_filters.py
  --- a/akvo/rsr/templatetags/rsr_filters.py
  +++ b/akvo/rsr/templatetags/rsr_filters.py
  @@ -6,9 +6,6 @@
   For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
   """
   
  -import datetime
  -import time
  -
   from django import template
   from django.conf import settings
   from decimal import Decimal, ROUND_HALF_UP
  @@ -24,18 +21,7 @@
       return dictionary.get(key)
   
   
  -@register.filter
  -def string_to_date(value):
  -    try:
  -        time_format = "%Y-%m-%d %H:%M:%S"
  -        fmt_time = time.strptime(value, time_format)
  -        return datetime.datetime(*fmt_time[:6])
  -    except:
  -        return value
  -
   # http://stackoverflow.com/questions/250357/smart-truncate-in-python
  -
  -
   @register.filter("smart_truncate")
   def smart_truncate(content, length=100, suffix='...'):
       if len(content) <= length:
  
verification_info: {"golden_diff": "diff --git a/akvo/rsr/templatetags/rsr_filters.py b/akvo/rsr/templatetags/rsr_filters.py\n--- a/akvo/rsr/templatetags/rsr_filters.py\n+++ b/akvo/rsr/templatetags/rsr_filters.py\n@@ -6,9 +6,6 @@\n For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n \"\"\"\n \n-import datetime\n-import time\n-\n from django import template\n from django.conf import settings\n from decimal import Decimal, ROUND_HALF_UP\n@@ -24,18 +21,7 @@\n     return dictionary.get(key)\n \n \n-@register.filter\n-def string_to_date(value):\n-    try:\n-        time_format = \"%Y-%m-%d %H:%M:%S\"\n-        fmt_time = time.strptime(value, time_format)\n-        return datetime.datetime(*fmt_time[:6])\n-    except:\n-        return value\n-\n # http://stackoverflow.com/questions/250357/smart-truncate-in-python\n-\n-\n @register.filter(\"smart_truncate\")\n def smart_truncate(content, length=100, suffix='...'):\n     if len(content) <= length:\n", "issue": "Project list widget fails due to a date vs. datetime formatting error\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nAkvo RSR is covered by the GNU Affero General Public License.\n\nSee more details in the license.txt file located at the root folder of the Akvo RSR module.\nFor additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n\"\"\"\n\nimport datetime\nimport time\n\nfrom django import template\nfrom django.conf import settings\nfrom decimal import Decimal, ROUND_HALF_UP\n\nregister = template.Library()\n\nDECIMAL_PLACES = getattr(settings, 'DECIMALS_DECIMAL_PLACES', 2)\n\n\n@register.filter\ndef get_item(dictionary, key):\n    \"\"\"Enable lookup in dicts.\"\"\"\n    return dictionary.get(key)\n\n\n@register.filter\ndef string_to_date(value):\n    try:\n        time_format = \"%Y-%m-%d %H:%M:%S\"\n        fmt_time = time.strptime(value, time_format)\n        return datetime.datetime(*fmt_time[:6])\n    except:\n        return value\n\n# http://stackoverflow.com/questions/250357/smart-truncate-in-python\n\n\n@register.filter(\"smart_truncate\")\ndef smart_truncate(content, length=100, suffix='...'):\n    if len(content) <= length:\n        return content\n    else:\n        return content[:length].rsplit(' ', 1)[0] + suffix\n\n\n@register.filter\ndef round(value, decimal_places=DECIMAL_PLACES):\n    try:\n        value = Decimal(str(value))\n    except:\n        return u''\n    if settings.DECIMALS_DEBUG:\n        decimal_result = value.quantize(Decimal(10) ** -decimal_places)\n        return decimal_result\n    else:\n        decimal_result = value.quantize(Decimal(10), ROUND_HALF_UP)\n        return 0 if decimal_result <= 0 else decimal_result\nround.is_safe = True\n\n\n@register.filter\ndef countries_list(obj):\n    \"\"\" return a list of the countries of all locations of an object.\n    currently works for Project and Organisation \"\"\"\n    return obj.locations.values_list('country__name', flat=True)\n\n\n@register.filter\ndef continents_list(obj):\n    \"\"\"return a list of the continents of all locations of an object\"\n    currently works for Project and Organisation \"\"\"\n    return obj.locations.values_list('country__continent', flat=True)\n\n\n@register.filter\ndef rsr_sorted_set(iterable):\n    \"\"\" create a set of the iterable to eliminate duplicates\n    then make a list of the set and sort it\n    used with countries_list and continents_list\n    \"\"\"\n    set_list = list(frozenset(iterable))\n    set_list.sort()\n    return set_list\n\n\n@register.filter\ndef load_partnerships_and_orgs(project):\n    return project.partnerships.prefetch_related('organisation').all()\n", "path": "akvo/rsr/templatetags/rsr_filters.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nAkvo RSR is covered by the GNU Affero General Public License.\n\nSee more details in the license.txt file located at the root folder of the Akvo RSR module.\nFor additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n\"\"\"\n\nfrom django import template\nfrom django.conf import settings\nfrom decimal import Decimal, ROUND_HALF_UP\n\nregister = template.Library()\n\nDECIMAL_PLACES = getattr(settings, 'DECIMALS_DECIMAL_PLACES', 2)\n\n\n@register.filter\ndef get_item(dictionary, key):\n    \"\"\"Enable lookup in dicts.\"\"\"\n    return dictionary.get(key)\n\n\n# http://stackoverflow.com/questions/250357/smart-truncate-in-python\n@register.filter(\"smart_truncate\")\ndef smart_truncate(content, length=100, suffix='...'):\n    if len(content) <= length:\n        return content\n    else:\n        return content[:length].rsplit(' ', 1)[0] + suffix\n\n\n@register.filter\ndef round(value, decimal_places=DECIMAL_PLACES):\n    try:\n        value = Decimal(str(value))\n    except:\n        return u''\n    if settings.DECIMALS_DEBUG:\n        decimal_result = value.quantize(Decimal(10) ** -decimal_places)\n        return decimal_result\n    else:\n        decimal_result = value.quantize(Decimal(10), ROUND_HALF_UP)\n        return 0 if decimal_result <= 0 else decimal_result\nround.is_safe = True\n\n\n@register.filter\ndef countries_list(obj):\n    \"\"\" return a list of the countries of all locations of an object.\n    currently works for Project and Organisation \"\"\"\n    return obj.locations.values_list('country__name', flat=True)\n\n\n@register.filter\ndef continents_list(obj):\n    \"\"\"return a list of the continents of all locations of an object\"\n    currently works for Project and Organisation \"\"\"\n    return obj.locations.values_list('country__continent', flat=True)\n\n\n@register.filter\ndef rsr_sorted_set(iterable):\n    \"\"\" create a set of the iterable to eliminate duplicates\n    then make a list of the set and sort it\n    used with countries_list and continents_list\n    \"\"\"\n    set_list = list(frozenset(iterable))\n    set_list.sort()\n    return set_list\n\n\n@register.filter\ndef load_partnerships_and_orgs(project):\n    return project.partnerships.prefetch_related('organisation').all()\n", "path": "akvo/rsr/templatetags/rsr_filters.py"}]}