Skip to content

Commit

Permalink
[Fixes #195] Feature: dataset attribute requiring a unit entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Wallschlaeger committed Nov 5, 2024
1 parent 2f712f0 commit 1c0eac6
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 2 deletions.
5 changes: 3 additions & 2 deletions geonode/layers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ def delete_queryset(self, request, queryset):
class AttributeAdmin(admin.ModelAdmin):
model = Attribute
list_display_links = ("id",)
list_display = ("id", "dataset", "attribute", "description", "attribute_label", "attribute_type", "display_order")
list_filter = ("dataset", "attribute_type")
list_display = ("id", "dataset", "attribute", "description", "attribute_label", "attribute_type", "attribute_unit", "display_order")
list_filter = ("dataset", "attribute_type", "attribute_unit")
search_fields = (
"attribute",
"attribute_label",
"attribute_unit"
)


Expand Down
1 change: 1 addition & 0 deletions geonode/layers/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class Meta:
model = Attribute
exclude = (
"attribute_type",
"attribute_unit"
"count",
"min",
"max",
Expand Down
24 changes: 24 additions & 0 deletions geonode/layers/migrations/0049_attribute_attribute_unit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.9 on 2024-11-05 21:12

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("layers", "0048_merge_20240927_1323"),
]

operations = [
migrations.AddField(
model_name="attribute",
name="attribute_unit",
field=models.CharField(
blank=True,
help_text="the unit of the attribute (kg, °C, mm etc)",
max_length=50,
null=True,
verbose_name="attribute unit",
),
),
]
9 changes: 9 additions & 0 deletions geonode/layers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,15 @@ class Attribute(models.Model):
default="xsd:string",
unique=False,
)
attribute_unit = models.CharField(
_("attribute unit"),
help_text=_("the unit of the attribute (kg, °C, mm etc)"),
max_length=50,
blank=True,
null=True,
unique=False,
)

visible = models.BooleanField(
_("visible?"), help_text=_("specifies if the attribute should be displayed in identify results"), default=True
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.2.9 on 2024-11-05 21:12

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("upload", "0039_auto_20220506_0833"),
]

operations = [
migrations.AlterField(
model_name="uploadparallelismlimit",
name="max_number",
field=models.PositiveSmallIntegerField(
default=5, help_text="The maximum number of parallel uploads (0 to 32767)."
),
),
migrations.AlterField(
model_name="uploadsizelimit",
name="max_size",
field=models.PositiveBigIntegerField(
default=104857600, help_text="The maximum file size allowed for upload (bytes)."
),
),
]

0 comments on commit 1c0eac6

Please sign in to comment.