Skip to content

Commit

Permalink
Add SiaeActivity.sector_group field
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Jun 12, 2024
1 parent c05ff6c commit e9f516b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
15 changes: 13 additions & 2 deletions lemarche/siaes/migrations/0076_siaeactivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class Migration(migrations.Migration):
dependencies = [
("sectors", "0003_sector_sectorgroup_ordering"),
("perimeters", "0005_alter_perimeter_post_codes"),
("siaes", "0075_historicalsiae"),
]

Expand Down Expand Up @@ -68,7 +69,7 @@ class Migration(migrations.Migration):
blank=True,
related_name="siae_activities",
to="sectors.sector",
verbose_name="Secteurs d'activité",
verbose_name="Activités",
),
),
(
Expand All @@ -80,13 +81,23 @@ class Migration(migrations.Migration):
verbose_name="Structure",
),
),
(
"sector_group",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="siae_activities",
to="sectors.sectorgroup",
verbose_name="Secteur d'activité",
),
),
(
"location",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="siae_activities_location",
related_name="siae_activities",
to="perimeters.perimeter",
verbose_name="Localisation",
),
Expand Down
12 changes: 10 additions & 2 deletions lemarche/siaes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1398,8 +1398,16 @@ class SiaeActivity(models.Model):
"siaes.Siae", verbose_name="Structure", related_name="activities", on_delete=models.CASCADE
)

sector_group = models.ForeignKey(
"sectors.SectorGroup",
verbose_name="Secteur d'activité",
related_name="siae_activities",
on_delete=models.SET_NULL,
null=True,
# blank=True,
)
sectors = models.ManyToManyField(
"sectors.Sector", verbose_name="Secteurs d'activité", related_name="siae_activities", blank=True
"sectors.Sector", verbose_name="Activités", related_name="siae_activities", blank=True
)
presta_type = ChoiceArrayField(
verbose_name="Type de prestation",
Expand All @@ -1411,7 +1419,7 @@ class SiaeActivity(models.Model):
location: Perimeter = models.ForeignKey(
to="perimeters.Perimeter",
verbose_name="Localisation",
related_name="siae_activities_location",
related_name="siae_activities",
on_delete=models.DO_NOTHING,
blank=True,
null=True,
Expand Down

0 comments on commit e9f516b

Please sign in to comment.