Skip to content

Commit

Permalink
Add SiaeActivity.location field
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Jun 12, 2024
1 parent f8e5894 commit 7675bd8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lemarche/siaes/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
11 changes: 11 additions & 0 deletions lemarche/siaes/migrations/0076_siaeactivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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é",
Expand Down
8 changes: 8 additions & 0 deletions lemarche/siaes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7675bd8

Please sign in to comment.