diff --git a/lemarche/siaes/admin.py b/lemarche/siaes/admin.py index ac2d91390..06d8f6c4b 100644 --- a/lemarche/siaes/admin.py +++ b/lemarche/siaes/admin.py @@ -686,7 +686,7 @@ class SiaeActivityAdmin(admin.ModelAdmin): search_fields = ["id", "siae__id", "siae__name"] search_help_text = "Cherche sur les champs : ID, Structure (ID, Nom)" - autocomplete_fields = ["siae"] + autocomplete_fields = ["siae", "sectors", "location"] readonly_fields = ["created_at", "updated_at"] def siae_with_link(self, siae_offer): diff --git a/lemarche/siaes/migrations/0076_siaeactivity.py b/lemarche/siaes/migrations/0076_siaeactivity.py index 2bb7e8895..8a9c3d80d 100644 --- a/lemarche/siaes/migrations/0076_siaeactivity.py +++ b/lemarche/siaes/migrations/0076_siaeactivity.py @@ -80,6 +80,17 @@ class Migration(migrations.Migration): verbose_name="Structure", ), ), + ( + "location", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.DO_NOTHING, + related_name="siae_activities_location", + to="perimeters.perimeter", + verbose_name="Localisation", + ), + ), ], options={ "verbose_name": "Activité", diff --git a/lemarche/siaes/models.py b/lemarche/siaes/models.py index e2609025e..a684b297e 100644 --- a/lemarche/siaes/models.py +++ b/lemarche/siaes/models.py @@ -1408,6 +1408,14 @@ class SiaeActivity(models.Model): null=True, db_index=True, ) + location: Perimeter = models.ForeignKey( + to="perimeters.Perimeter", + verbose_name="Localisation", + related_name="siae_activities_location", + on_delete=models.DO_NOTHING, + blank=True, + null=True, + ) geo_range = models.CharField( verbose_name="Périmètre d'intervention", max_length=20,