We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Send an email on feeback record creation
- rel https://github.com/makinacorpus/Geotrek-rando/issues/132
- Send to managers
- Import test send email from Geotrek-rando


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `geotrek/feedback/models.py`
Content:
```
1 import logging
2 
3 from django.conf import settings
4 from django.db import models
5 from django.contrib.gis.db import models as gis_models
6 from django.contrib.contenttypes.generic import GenericForeignKey
7 from django.contrib.contenttypes.models import ContentType
8 from django.utils.translation import ugettext_lazy as _
9 from django.db.models.signals import post_save
10 from django.dispatch import receiver
11 from mapentity.models import MapEntityMixin
12 
13 from geotrek.common.models import TimeStampedModel
14 
15 from .helpers import send_report_managers
16 
17 
18 logger = logging.getLogger(__name__)
19 
20 
21 class Report(MapEntityMixin, TimeStampedModel):
22     """ User reports, mainly submitted via *Geotrek-rando*.
23     """
24     name = models.CharField(verbose_name=_(u"Name"), max_length=256)
25     email = models.EmailField(verbose_name=_(u"Email"))
26     comment = models.TextField(blank=True,
27                                default="",
28                                verbose_name=_(u"Comment"))
29     category = models.ForeignKey('ReportCategory',
30                                  null=True,
31                                  blank=True,
32                                  default=None,
33                                  verbose_name=_(u"Category"))
34     geom = gis_models.PointField(null=True,
35                                  blank=True,
36                                  default=None,
37                                  verbose_name=_(u"Location"),
38                                  srid=settings.SRID)
39     context_content_type = models.ForeignKey(ContentType,
40                                              null=True,
41                                              blank=True,
42                                              editable=False)
43     context_object_id = models.PositiveIntegerField(null=True,
44                                                     blank=True,
45                                                     editable=False)
46     context_object = GenericForeignKey('context_content_type',
47                                        'context_object_id')
48 
49     objects = gis_models.GeoManager()
50 
51     class Meta:
52         db_table = 'f_t_signalement'
53         verbose_name = _(u"Report")
54         verbose_name_plural = _(u"Reports")
55         ordering = ['-date_insert']
56 
57     def __unicode__(self):
58         return self.name
59 
60     @property
61     def name_display(self):
62         return u'<a data-pk="%s" href="%s" title="%s" >%s</a>' % (self.pk,
63                                                                   self.get_detail_url(),
64                                                                   self,
65                                                                   self)
66 
67 
68 @receiver(post_save, sender=Report, dispatch_uid="on_report_created")
69 def on_report_created(sender, instance, created, **kwargs):
70     """ Send an email to managers when a report is created.
71     """
72     try:
73         send_report_managers(instance)
74     except Exception as e:
75         logger.error('Email could not be sent to managers.')
76         logger.exception(e)  # This sends an email to admins :)
77 
78 
79 class ReportCategory(models.Model):
80     category = models.CharField(verbose_name=_(u"Category"),
81                                 max_length=128)
82 
83     class Meta:
84         db_table = 'f_b_categorie'
85         verbose_name = _(u"Category")
86         verbose_name_plural = _(u"Categories")
87 
88     def __unicode__(self):
89         return self.category
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()

```

diff --git a/geotrek/feedback/models.py b/geotrek/feedback/models.py
--- a/geotrek/feedback/models.py
+++ b/geotrek/feedback/models.py
@@ -66,9 +66,11 @@
 
 
 @receiver(post_save, sender=Report, dispatch_uid="on_report_created")
-def on_report_created(sender, instance, created, **kwargs):
+def on_report_saved(sender, instance, created, **kwargs):
     """ Send an email to managers when a report is created.
     """
+    if not created:
+        return
     try:
         send_report_managers(instance)
     except Exception as e:

{"golden_diff": "diff --git a/geotrek/feedback/models.py b/geotrek/feedback/models.py\n--- a/geotrek/feedback/models.py\n+++ b/geotrek/feedback/models.py\n@@ -66,9 +66,11 @@\n \n \n @receiver(post_save, sender=Report, dispatch_uid=\"on_report_created\")\n-def on_report_created(sender, instance, created, **kwargs):\n+def on_report_saved(sender, instance, created, **kwargs):\n     \"\"\" Send an email to managers when a report is created.\n     \"\"\"\n+    if not created:\n+        return\n     try:\n         send_report_managers(instance)\n     except Exception as e:\n", "issue": "Send an email on feeback record creation\n- rel https://github.com/makinacorpus/Geotrek-rando/issues/132\n- Send to managers\n- Import test send email from Geotrek-rando\n\n", "before_files": [{"content": "import logging\n\nfrom django.conf import settings\nfrom django.db import models\nfrom django.contrib.gis.db import models as gis_models\nfrom django.contrib.contenttypes.generic import GenericForeignKey\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.db.models.signals import post_save\nfrom django.dispatch import receiver\nfrom mapentity.models import MapEntityMixin\n\nfrom geotrek.common.models import TimeStampedModel\n\nfrom .helpers import send_report_managers\n\n\nlogger = logging.getLogger(__name__)\n\n\nclass Report(MapEntityMixin, TimeStampedModel):\n    \"\"\" User reports, mainly submitted via *Geotrek-rando*.\n    \"\"\"\n    name = models.CharField(verbose_name=_(u\"Name\"), max_length=256)\n    email = models.EmailField(verbose_name=_(u\"Email\"))\n    comment = models.TextField(blank=True,\n                               default=\"\",\n                               verbose_name=_(u\"Comment\"))\n    category = models.ForeignKey('ReportCategory',\n                                 null=True,\n                                 blank=True,\n                                 default=None,\n                                 verbose_name=_(u\"Category\"))\n    geom = gis_models.PointField(null=True,\n                                 blank=True,\n                                 default=None,\n                                 verbose_name=_(u\"Location\"),\n                                 srid=settings.SRID)\n    context_content_type = models.ForeignKey(ContentType,\n                                             null=True,\n                                             blank=True,\n                                             editable=False)\n    context_object_id = models.PositiveIntegerField(null=True,\n                                                    blank=True,\n                                                    editable=False)\n    context_object = GenericForeignKey('context_content_type',\n                                       'context_object_id')\n\n    objects = gis_models.GeoManager()\n\n    class Meta:\n        db_table = 'f_t_signalement'\n        verbose_name = _(u\"Report\")\n        verbose_name_plural = _(u\"Reports\")\n        ordering = ['-date_insert']\n\n    def __unicode__(self):\n        return self.name\n\n    @property\n    def name_display(self):\n        return u'<a data-pk=\"%s\" href=\"%s\" title=\"%s\" >%s</a>' % (self.pk,\n                                                                  self.get_detail_url(),\n                                                                  self,\n                                                                  self)\n\n\n@receiver(post_save, sender=Report, dispatch_uid=\"on_report_created\")\ndef on_report_created(sender, instance, created, **kwargs):\n    \"\"\" Send an email to managers when a report is created.\n    \"\"\"\n    try:\n        send_report_managers(instance)\n    except Exception as e:\n        logger.error('Email could not be sent to managers.')\n        logger.exception(e)  # This sends an email to admins :)\n\n\nclass ReportCategory(models.Model):\n    category = models.CharField(verbose_name=_(u\"Category\"),\n                                max_length=128)\n\n    class Meta:\n        db_table = 'f_b_categorie'\n        verbose_name = _(u\"Category\")\n        verbose_name_plural = _(u\"Categories\")\n\n    def __unicode__(self):\n        return self.category\n", "path": "geotrek/feedback/models.py"}], "after_files": [{"content": "import logging\n\nfrom django.conf import settings\nfrom django.db import models\nfrom django.contrib.gis.db import models as gis_models\nfrom django.contrib.contenttypes.generic import GenericForeignKey\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.db.models.signals import post_save\nfrom django.dispatch import receiver\nfrom mapentity.models import MapEntityMixin\n\nfrom geotrek.common.models import TimeStampedModel\n\nfrom .helpers import send_report_managers\n\n\nlogger = logging.getLogger(__name__)\n\n\nclass Report(MapEntityMixin, TimeStampedModel):\n    \"\"\" User reports, mainly submitted via *Geotrek-rando*.\n    \"\"\"\n    name = models.CharField(verbose_name=_(u\"Name\"), max_length=256)\n    email = models.EmailField(verbose_name=_(u\"Email\"))\n    comment = models.TextField(blank=True,\n                               default=\"\",\n                               verbose_name=_(u\"Comment\"))\n    category = models.ForeignKey('ReportCategory',\n                                 null=True,\n                                 blank=True,\n                                 default=None,\n                                 verbose_name=_(u\"Category\"))\n    geom = gis_models.PointField(null=True,\n                                 blank=True,\n                                 default=None,\n                                 verbose_name=_(u\"Location\"),\n                                 srid=settings.SRID)\n    context_content_type = models.ForeignKey(ContentType,\n                                             null=True,\n                                             blank=True,\n                                             editable=False)\n    context_object_id = models.PositiveIntegerField(null=True,\n                                                    blank=True,\n                                                    editable=False)\n    context_object = GenericForeignKey('context_content_type',\n                                       'context_object_id')\n\n    objects = gis_models.GeoManager()\n\n    class Meta:\n        db_table = 'f_t_signalement'\n        verbose_name = _(u\"Report\")\n        verbose_name_plural = _(u\"Reports\")\n        ordering = ['-date_insert']\n\n    def __unicode__(self):\n        return self.name\n\n    @property\n    def name_display(self):\n        return u'<a data-pk=\"%s\" href=\"%s\" title=\"%s\" >%s</a>' % (self.pk,\n                                                                  self.get_detail_url(),\n                                                                  self,\n                                                                  self)\n\n\n@receiver(post_save, sender=Report, dispatch_uid=\"on_report_created\")\ndef on_report_saved(sender, instance, created, **kwargs):\n    \"\"\" Send an email to managers when a report is created.\n    \"\"\"\n    if not created:\n        return\n    try:\n        send_report_managers(instance)\n    except Exception as e:\n        logger.error('Email could not be sent to managers.')\n        logger.exception(e)  # This sends an email to admins :)\n\n\nclass ReportCategory(models.Model):\n    category = models.CharField(verbose_name=_(u\"Category\"),\n                                max_length=128)\n\n    class Meta:\n        db_table = 'f_b_categorie'\n        verbose_name = _(u\"Category\")\n        verbose_name_plural = _(u\"Categories\")\n\n    def __unicode__(self):\n        return self.category\n", "path": "geotrek/feedback/models.py"}]}