We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Infrastructure CONDITION - Should not be mandatory
Many will just localize their infrastructures. 


--- 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/infrastructure/models.py`
Content:
```
1 from django.db import models
2 from django.utils.translation import ugettext_lazy as _
3 from django.contrib.gis.db import models as gismodels
4 
5 from extended_choices import Choices
6 from mapentity.models import MapEntityMixin
7 
8 from geotrek.common.utils import classproperty
9 from geotrek.core.models import Topology, Path
10 from geotrek.authent.models import StructureRelatedManager, StructureRelated
11 
12 
13 INFRASTRUCTURE_TYPES = Choices(
14     ('BUILDING', 'A', _("Building")),
15     ('FACILITY', 'E', _("Facility")),
16     ('SIGNAGE', 'S', _("Signage")),
17 )
18 
19 
20 class InfrastructureTypeQuerySet(models.query.QuerySet):
21     def for_infrastructures(self):
22         return self.exclude(type__exact=INFRASTRUCTURE_TYPES.SIGNAGE)
23 
24     def for_signages(self):
25         return self.filter(type__exact=INFRASTRUCTURE_TYPES.SIGNAGE)
26 
27 
28 class InfrastructureTypeManager(models.Manager):
29     def get_queryset(self):
30         return InfrastructureTypeQuerySet(self.model, using=self._db)
31 
32     def for_signages(self):
33         return self.get_queryset().for_signages()
34 
35     def for_infrastructures(self):
36         return self.get_queryset().for_infrastructures()
37 
38 
39 class InfrastructureType(StructureRelated):
40     """ Types of infrastructures (bridge, WC, stairs, ...) """
41     label = models.CharField(db_column="nom", max_length=128)
42     type = models.CharField(db_column="type", max_length=1, choices=INFRASTRUCTURE_TYPES)
43 
44     objects = InfrastructureTypeManager()
45 
46     class Meta:
47         db_table = 'a_b_amenagement'
48         verbose_name = _(u"Infrastructure Type")
49         verbose_name_plural = _(u"Infrastructure Types")
50         ordering = ['label', 'type']
51 
52     def __unicode__(self):
53         return self.label
54 
55 
56 class InfrastructureCondition(StructureRelated):
57     label = models.CharField(verbose_name=_(u"Name"), db_column="etat", max_length=250)
58 
59     class Meta:
60         verbose_name = _(u"Infrastructure Condition")
61         verbose_name_plural = _(u"Infrastructure Conditions")
62         db_table = "a_b_etat"
63 
64     def __unicode__(self):
65         return self.label
66 
67 
68 class BaseInfrastructure(MapEntityMixin, Topology, StructureRelated):
69     """ A generic infrastructure in the park """
70     topo_object = models.OneToOneField(Topology, parent_link=True,
71                                        db_column='evenement')
72 
73     name = models.CharField(db_column="nom", max_length=128,
74                             help_text=_(u"Reference, code, ..."), verbose_name=_("Name"))
75     description = models.TextField(blank=True, db_column='description',
76                                    verbose_name=_("Description"), help_text=_(u"Specificites"))
77     type = models.ForeignKey(InfrastructureType, db_column='type', verbose_name=_("Type"))
78     condition = models.ForeignKey(InfrastructureCondition, db_column='etat',
79                                   verbose_name=_("Condition"), null=True,
80                                   on_delete=models.PROTECT)
81 
82     class Meta:
83         db_table = 'a_t_amenagement'
84 
85     def __unicode__(self):
86         return self.name
87 
88     @property
89     def name_display(self):
90         return '<a href="%s" title="%s" >%s</a>' % (self.get_detail_url(),
91                                                     self,
92                                                     self)
93 
94     @property
95     def name_csv_display(self):
96         return unicode(self)
97 
98     @property
99     def type_display(self):
100         return unicode(self.type)
101 
102     @property
103     def cities_display(self):
104         if hasattr(self, 'cities'):
105             return [unicode(c) for c in self.cities]
106         return []
107 
108     @classproperty
109     def cities_verbose_name(cls):
110         return _("Cities")
111 
112 
113 class InfrastructureGISManager(gismodels.GeoManager):
114     """ Overide default typology mixin manager, and filter by type. """
115     def get_queryset(self):
116         return super(InfrastructureGISManager, self).get_queryset().exclude(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)
117 
118 
119 class InfrastructureStructureManager(StructureRelatedManager):
120     """ Overide default structure related manager, and filter by type. """
121     def get_queryset(self):
122         return super(InfrastructureStructureManager, self).get_queryset().exclude(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)
123 
124 
125 class Infrastructure(BaseInfrastructure):
126     """ An infrastructure in the park, which is not of type SIGNAGE """
127     objects = BaseInfrastructure.get_manager_cls(InfrastructureGISManager)()
128     in_structure = InfrastructureStructureManager()
129 
130     class Meta:
131         proxy = True
132         verbose_name = _(u"Infrastructure")
133         verbose_name_plural = _(u"Infrastructures")
134 
135     @classmethod
136     def path_infrastructures(cls, path):
137         return cls.objects.existing().filter(aggregations__path=path).distinct('pk')
138 
139     @classmethod
140     def topology_infrastructures(cls, topology):
141         return cls.overlapping(topology)
142 
143 Path.add_property('infrastructures', lambda self: Infrastructure.path_infrastructures(self), _(u"Infrastructures"))
144 Topology.add_property('infrastructures', lambda self: Infrastructure.topology_infrastructures(self), _(u"Infrastructures"))
145 
146 
147 class SignageGISManager(gismodels.GeoManager):
148     """ Overide default typology mixin manager, and filter by type. """
149     def get_queryset(self):
150         return super(SignageGISManager, self).get_queryset().filter(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)
151 
152 
153 class SignageStructureManager(StructureRelatedManager):
154     """ Overide default structure related manager, and filter by type. """
155     def get_queryset(self):
156         return super(SignageStructureManager, self).get_queryset().filter(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)
157 
158 
159 class Signage(BaseInfrastructure):
160     """ An infrastructure in the park, which is of type SIGNAGE """
161     objects = BaseInfrastructure.get_manager_cls(SignageGISManager)()
162     in_structure = SignageStructureManager()
163 
164     class Meta:
165         proxy = True
166         verbose_name = _(u"Signage")
167         verbose_name_plural = _(u"Signages")
168 
169     @classmethod
170     def path_signages(cls, path):
171         return cls.objects.existing().filter(aggregations__path=path).distinct('pk')
172 
173     @classmethod
174     def topology_signages(cls, topology):
175         return cls.overlapping(topology)
176 
177 Path.add_property('signages', lambda self: Signage.path_signages(self), _(u"Signages"))
178 Topology.add_property('signages', lambda self: Signage.topology_signages(self), _(u"Signages"))
179
```
--- 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/infrastructure/models.py b/geotrek/infrastructure/models.py
--- a/geotrek/infrastructure/models.py
+++ b/geotrek/infrastructure/models.py
@@ -76,7 +76,7 @@
                                    verbose_name=_("Description"), help_text=_(u"Specificites"))
     type = models.ForeignKey(InfrastructureType, db_column='type', verbose_name=_("Type"))
     condition = models.ForeignKey(InfrastructureCondition, db_column='etat',
-                                  verbose_name=_("Condition"), null=True,
+                                  verbose_name=_("Condition"), blank=True, null=True,
                                   on_delete=models.PROTECT)
 
     class Meta:

{"golden_diff": "diff --git a/geotrek/infrastructure/models.py b/geotrek/infrastructure/models.py\n--- a/geotrek/infrastructure/models.py\n+++ b/geotrek/infrastructure/models.py\n@@ -76,7 +76,7 @@\n                                    verbose_name=_(\"Description\"), help_text=_(u\"Specificites\"))\n     type = models.ForeignKey(InfrastructureType, db_column='type', verbose_name=_(\"Type\"))\n     condition = models.ForeignKey(InfrastructureCondition, db_column='etat',\n-                                  verbose_name=_(\"Condition\"), null=True,\n+                                  verbose_name=_(\"Condition\"), blank=True, null=True,\n                                   on_delete=models.PROTECT)\n \n     class Meta:\n", "issue": "Infrastructure CONDITION - Should not be mandatory\nMany will just localize their infrastructures. \n\n", "before_files": [{"content": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.contrib.gis.db import models as gismodels\n\nfrom extended_choices import Choices\nfrom mapentity.models import MapEntityMixin\n\nfrom geotrek.common.utils import classproperty\nfrom geotrek.core.models import Topology, Path\nfrom geotrek.authent.models import StructureRelatedManager, StructureRelated\n\n\nINFRASTRUCTURE_TYPES = Choices(\n    ('BUILDING', 'A', _(\"Building\")),\n    ('FACILITY', 'E', _(\"Facility\")),\n    ('SIGNAGE', 'S', _(\"Signage\")),\n)\n\n\nclass InfrastructureTypeQuerySet(models.query.QuerySet):\n    def for_infrastructures(self):\n        return self.exclude(type__exact=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n    def for_signages(self):\n        return self.filter(type__exact=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n\nclass InfrastructureTypeManager(models.Manager):\n    def get_queryset(self):\n        return InfrastructureTypeQuerySet(self.model, using=self._db)\n\n    def for_signages(self):\n        return self.get_queryset().for_signages()\n\n    def for_infrastructures(self):\n        return self.get_queryset().for_infrastructures()\n\n\nclass InfrastructureType(StructureRelated):\n    \"\"\" Types of infrastructures (bridge, WC, stairs, ...) \"\"\"\n    label = models.CharField(db_column=\"nom\", max_length=128)\n    type = models.CharField(db_column=\"type\", max_length=1, choices=INFRASTRUCTURE_TYPES)\n\n    objects = InfrastructureTypeManager()\n\n    class Meta:\n        db_table = 'a_b_amenagement'\n        verbose_name = _(u\"Infrastructure Type\")\n        verbose_name_plural = _(u\"Infrastructure Types\")\n        ordering = ['label', 'type']\n\n    def __unicode__(self):\n        return self.label\n\n\nclass InfrastructureCondition(StructureRelated):\n    label = models.CharField(verbose_name=_(u\"Name\"), db_column=\"etat\", max_length=250)\n\n    class Meta:\n        verbose_name = _(u\"Infrastructure Condition\")\n        verbose_name_plural = _(u\"Infrastructure Conditions\")\n        db_table = \"a_b_etat\"\n\n    def __unicode__(self):\n        return self.label\n\n\nclass BaseInfrastructure(MapEntityMixin, Topology, StructureRelated):\n    \"\"\" A generic infrastructure in the park \"\"\"\n    topo_object = models.OneToOneField(Topology, parent_link=True,\n                                       db_column='evenement')\n\n    name = models.CharField(db_column=\"nom\", max_length=128,\n                            help_text=_(u\"Reference, code, ...\"), verbose_name=_(\"Name\"))\n    description = models.TextField(blank=True, db_column='description',\n                                   verbose_name=_(\"Description\"), help_text=_(u\"Specificites\"))\n    type = models.ForeignKey(InfrastructureType, db_column='type', verbose_name=_(\"Type\"))\n    condition = models.ForeignKey(InfrastructureCondition, db_column='etat',\n                                  verbose_name=_(\"Condition\"), null=True,\n                                  on_delete=models.PROTECT)\n\n    class Meta:\n        db_table = 'a_t_amenagement'\n\n    def __unicode__(self):\n        return self.name\n\n    @property\n    def name_display(self):\n        return '<a href=\"%s\" title=\"%s\" >%s</a>' % (self.get_detail_url(),\n                                                    self,\n                                                    self)\n\n    @property\n    def name_csv_display(self):\n        return unicode(self)\n\n    @property\n    def type_display(self):\n        return unicode(self.type)\n\n    @property\n    def cities_display(self):\n        if hasattr(self, 'cities'):\n            return [unicode(c) for c in self.cities]\n        return []\n\n    @classproperty\n    def cities_verbose_name(cls):\n        return _(\"Cities\")\n\n\nclass InfrastructureGISManager(gismodels.GeoManager):\n    \"\"\" Overide default typology mixin manager, and filter by type. \"\"\"\n    def get_queryset(self):\n        return super(InfrastructureGISManager, self).get_queryset().exclude(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n\nclass InfrastructureStructureManager(StructureRelatedManager):\n    \"\"\" Overide default structure related manager, and filter by type. \"\"\"\n    def get_queryset(self):\n        return super(InfrastructureStructureManager, self).get_queryset().exclude(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n\nclass Infrastructure(BaseInfrastructure):\n    \"\"\" An infrastructure in the park, which is not of type SIGNAGE \"\"\"\n    objects = BaseInfrastructure.get_manager_cls(InfrastructureGISManager)()\n    in_structure = InfrastructureStructureManager()\n\n    class Meta:\n        proxy = True\n        verbose_name = _(u\"Infrastructure\")\n        verbose_name_plural = _(u\"Infrastructures\")\n\n    @classmethod\n    def path_infrastructures(cls, path):\n        return cls.objects.existing().filter(aggregations__path=path).distinct('pk')\n\n    @classmethod\n    def topology_infrastructures(cls, topology):\n        return cls.overlapping(topology)\n\nPath.add_property('infrastructures', lambda self: Infrastructure.path_infrastructures(self), _(u\"Infrastructures\"))\nTopology.add_property('infrastructures', lambda self: Infrastructure.topology_infrastructures(self), _(u\"Infrastructures\"))\n\n\nclass SignageGISManager(gismodels.GeoManager):\n    \"\"\" Overide default typology mixin manager, and filter by type. \"\"\"\n    def get_queryset(self):\n        return super(SignageGISManager, self).get_queryset().filter(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n\nclass SignageStructureManager(StructureRelatedManager):\n    \"\"\" Overide default structure related manager, and filter by type. \"\"\"\n    def get_queryset(self):\n        return super(SignageStructureManager, self).get_queryset().filter(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n\nclass Signage(BaseInfrastructure):\n    \"\"\" An infrastructure in the park, which is of type SIGNAGE \"\"\"\n    objects = BaseInfrastructure.get_manager_cls(SignageGISManager)()\n    in_structure = SignageStructureManager()\n\n    class Meta:\n        proxy = True\n        verbose_name = _(u\"Signage\")\n        verbose_name_plural = _(u\"Signages\")\n\n    @classmethod\n    def path_signages(cls, path):\n        return cls.objects.existing().filter(aggregations__path=path).distinct('pk')\n\n    @classmethod\n    def topology_signages(cls, topology):\n        return cls.overlapping(topology)\n\nPath.add_property('signages', lambda self: Signage.path_signages(self), _(u\"Signages\"))\nTopology.add_property('signages', lambda self: Signage.topology_signages(self), _(u\"Signages\"))\n", "path": "geotrek/infrastructure/models.py"}], "after_files": [{"content": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.contrib.gis.db import models as gismodels\n\nfrom extended_choices import Choices\nfrom mapentity.models import MapEntityMixin\n\nfrom geotrek.common.utils import classproperty\nfrom geotrek.core.models import Topology, Path\nfrom geotrek.authent.models import StructureRelatedManager, StructureRelated\n\n\nINFRASTRUCTURE_TYPES = Choices(\n    ('BUILDING', 'A', _(\"Building\")),\n    ('FACILITY', 'E', _(\"Facility\")),\n    ('SIGNAGE', 'S', _(\"Signage\")),\n)\n\n\nclass InfrastructureTypeQuerySet(models.query.QuerySet):\n    def for_infrastructures(self):\n        return self.exclude(type__exact=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n    def for_signages(self):\n        return self.filter(type__exact=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n\nclass InfrastructureTypeManager(models.Manager):\n    def get_queryset(self):\n        return InfrastructureTypeQuerySet(self.model, using=self._db)\n\n    def for_signages(self):\n        return self.get_queryset().for_signages()\n\n    def for_infrastructures(self):\n        return self.get_queryset().for_infrastructures()\n\n\nclass InfrastructureType(StructureRelated):\n    \"\"\" Types of infrastructures (bridge, WC, stairs, ...) \"\"\"\n    label = models.CharField(db_column=\"nom\", max_length=128)\n    type = models.CharField(db_column=\"type\", max_length=1, choices=INFRASTRUCTURE_TYPES)\n\n    objects = InfrastructureTypeManager()\n\n    class Meta:\n        db_table = 'a_b_amenagement'\n        verbose_name = _(u\"Infrastructure Type\")\n        verbose_name_plural = _(u\"Infrastructure Types\")\n        ordering = ['label', 'type']\n\n    def __unicode__(self):\n        return self.label\n\n\nclass InfrastructureCondition(StructureRelated):\n    label = models.CharField(verbose_name=_(u\"Name\"), db_column=\"etat\", max_length=250)\n\n    class Meta:\n        verbose_name = _(u\"Infrastructure Condition\")\n        verbose_name_plural = _(u\"Infrastructure Conditions\")\n        db_table = \"a_b_etat\"\n\n    def __unicode__(self):\n        return self.label\n\n\nclass BaseInfrastructure(MapEntityMixin, Topology, StructureRelated):\n    \"\"\" A generic infrastructure in the park \"\"\"\n    topo_object = models.OneToOneField(Topology, parent_link=True,\n                                       db_column='evenement')\n\n    name = models.CharField(db_column=\"nom\", max_length=128,\n                            help_text=_(u\"Reference, code, ...\"), verbose_name=_(\"Name\"))\n    description = models.TextField(blank=True, db_column='description',\n                                   verbose_name=_(\"Description\"), help_text=_(u\"Specificites\"))\n    type = models.ForeignKey(InfrastructureType, db_column='type', verbose_name=_(\"Type\"))\n    condition = models.ForeignKey(InfrastructureCondition, db_column='etat',\n                                  verbose_name=_(\"Condition\"), blank=True, null=True,\n                                  on_delete=models.PROTECT)\n\n    class Meta:\n        db_table = 'a_t_amenagement'\n\n    def __unicode__(self):\n        return self.name\n\n    @property\n    def name_display(self):\n        return '<a href=\"%s\" title=\"%s\" >%s</a>' % (self.get_detail_url(),\n                                                    self,\n                                                    self)\n\n    @property\n    def name_csv_display(self):\n        return unicode(self)\n\n    @property\n    def type_display(self):\n        return unicode(self.type)\n\n    @property\n    def cities_display(self):\n        if hasattr(self, 'cities'):\n            return [unicode(c) for c in self.cities]\n        return []\n\n    @classproperty\n    def cities_verbose_name(cls):\n        return _(\"Cities\")\n\n\nclass InfrastructureGISManager(gismodels.GeoManager):\n    \"\"\" Overide default typology mixin manager, and filter by type. \"\"\"\n    def get_queryset(self):\n        return super(InfrastructureGISManager, self).get_queryset().exclude(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n\nclass InfrastructureStructureManager(StructureRelatedManager):\n    \"\"\" Overide default structure related manager, and filter by type. \"\"\"\n    def get_queryset(self):\n        return super(InfrastructureStructureManager, self).get_queryset().exclude(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n\nclass Infrastructure(BaseInfrastructure):\n    \"\"\" An infrastructure in the park, which is not of type SIGNAGE \"\"\"\n    objects = BaseInfrastructure.get_manager_cls(InfrastructureGISManager)()\n    in_structure = InfrastructureStructureManager()\n\n    class Meta:\n        proxy = True\n        verbose_name = _(u\"Infrastructure\")\n        verbose_name_plural = _(u\"Infrastructures\")\n\n    @classmethod\n    def path_infrastructures(cls, path):\n        return cls.objects.existing().filter(aggregations__path=path).distinct('pk')\n\n    @classmethod\n    def topology_infrastructures(cls, topology):\n        return cls.overlapping(topology)\n\nPath.add_property('infrastructures', lambda self: Infrastructure.path_infrastructures(self), _(u\"Infrastructures\"))\nTopology.add_property('infrastructures', lambda self: Infrastructure.topology_infrastructures(self), _(u\"Infrastructures\"))\n\n\nclass SignageGISManager(gismodels.GeoManager):\n    \"\"\" Overide default typology mixin manager, and filter by type. \"\"\"\n    def get_queryset(self):\n        return super(SignageGISManager, self).get_queryset().filter(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n\nclass SignageStructureManager(StructureRelatedManager):\n    \"\"\" Overide default structure related manager, and filter by type. \"\"\"\n    def get_queryset(self):\n        return super(SignageStructureManager, self).get_queryset().filter(type__type=INFRASTRUCTURE_TYPES.SIGNAGE)\n\n\nclass Signage(BaseInfrastructure):\n    \"\"\" An infrastructure in the park, which is of type SIGNAGE \"\"\"\n    objects = BaseInfrastructure.get_manager_cls(SignageGISManager)()\n    in_structure = SignageStructureManager()\n\n    class Meta:\n        proxy = True\n        verbose_name = _(u\"Signage\")\n        verbose_name_plural = _(u\"Signages\")\n\n    @classmethod\n    def path_signages(cls, path):\n        return cls.objects.existing().filter(aggregations__path=path).distinct('pk')\n\n    @classmethod\n    def topology_signages(cls, topology):\n        return cls.overlapping(topology)\n\nPath.add_property('signages', lambda self: Signage.path_signages(self), _(u\"Signages\"))\nTopology.add_property('signages', lambda self: Signage.topology_signages(self), _(u\"Signages\"))\n", "path": "geotrek/infrastructure/models.py"}]}