Skip to content

Commit

Permalink
fixmissing station on contribution admin
Browse files Browse the repository at this point in the history
  • Loading branch information
submarcos committed May 14, 2024
1 parent ab3f860 commit ac2913c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 0 additions & 4 deletions georiviere/contribution/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",)
Expand Down
17 changes: 17 additions & 0 deletions georiviere/observations/migrations/0024_auto_20240514_0849.py
Original file line number Diff line number Diff line change
@@ -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'},
),
]
1 change: 1 addition & 0 deletions georiviere/observations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ac2913c

Please sign in to comment.