diff --git a/georiviere/contribution/admin.py b/georiviere/contribution/admin.py index e87d503e..eaaf2ccb 100644 --- a/georiviere/contribution/admin.py +++ b/georiviere/contribution/admin.py @@ -121,10 +121,6 @@ class CustomContributionAdmin(LeafletGeoAdmin, admin.ModelAdmin): form = forms.CustomContributionForm inlines = [CustomContribAttachmentInline] - def station(self, obj): - return obj.station.label - station.admin_order_field = 'label' - def get_readonly_fields(self, request, obj=None): if not obj or not obj.pk: return ("data",) diff --git a/georiviere/observations/migrations/0024_auto_20240514_0849.py b/georiviere/observations/migrations/0024_auto_20240514_0849.py new file mode 100644 index 00000000..628231e9 --- /dev/null +++ b/georiviere/observations/migrations/0024_auto_20240514_0849.py @@ -0,0 +1,17 @@ +# Generated by Django 3.1.14 on 2024-05-14 08:49 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('observations', '0023_auto_20230220_1703'), + ] + + operations = [ + migrations.AlterModelOptions( + name='station', + options={'ordering': ('label', 'pk'), 'verbose_name': 'Station', 'verbose_name_plural': 'Stations'}, + ), + ] diff --git a/georiviere/observations/models.py b/georiviere/observations/models.py index 2302582a..c08d336e 100644 --- a/georiviere/observations/models.py +++ b/georiviere/observations/models.py @@ -89,6 +89,7 @@ class LocalInfluenceChoices(models.IntegerChoices): class Meta: verbose_name = _("Station") verbose_name_plural = _("Stations") + ordering = ('label', 'pk') def __str__(self): return "{1} ({0})".format(self.code, self.label)