Skip to content

Commit

Permalink
Merge pull request #197 from zalf-rdm/issue_#195_Feature_dataset_attr…
Browse files Browse the repository at this point in the history
…ibute_requiring_a_unit_entry

Issue #195 feature dataset attribute requiring a unit entry
  • Loading branch information
mwallschlaeger authored Nov 7, 2024
2 parents 2f712f0 + 30846f4 commit f640dca
Show file tree
Hide file tree
Showing 7 changed files with 75 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
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 used unit for the attribute"),
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
Expand Up @@ -411,6 +411,7 @@ <h5>{% trans "Attributes" %}</h5>
<th>{% trans "Attribute" %}</th>
<th>{% trans "Label" %}</th>
<th>{% trans "Description" %}</th>
<th>{% trans "Unit" %}</th>
<th>{% trans "Display Order" %}</th>
<th>{% trans "Display Type" %}</th>
<th>{% trans "Visible" %}</th>
Expand All @@ -421,6 +422,7 @@ <h5>{% trans "Attributes" %}</h5>
<td><div style="display:none">{{form.id}}</div>{{form.attribute}}</td>
<td>{{form.attribute_label}}</td>
<td>{{form.description}}</td>
<td>{{form.attribute_unit}}</td>
<td>{{form.display_order}}</td>
<td>{{form.featureinfo_type}}</td>
<td>{{form.visible}}</td>
Expand Down
1 change: 1 addition & 0 deletions geonode/layers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ def dataset_metadata(
la = Attribute.objects.get(id=int(form["id"].id))
la.description = form["description"]
la.attribute_label = form["attribute_label"]
la.attribute_unit = form["attribute_unit"]
la.visible = form["visible"]
la.display_order = form["display_order"]
la.featureinfo_type = form["featureinfo_type"]
Expand Down
9 changes: 9 additions & 0 deletions geonode/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3417,10 +3417,19 @@ msgstr "Titel der Attribute wie in GeoNode dargestellt"
msgid "attribute type"
msgstr "Attributtyp"

#: geonode/layers/models.py:427
msgid "attribute type"
msgstr "Attributeinheit"

#: geonode/layers/models.py:420
msgid "the data type of the attribute (integer, string, geometry, etc)"
msgstr "der Datenyp des Attributes (Integer, Zeichenkette, Geometrie , etc)"

#: geonode/layers/models.py:428
msgid ""the used unit for the attribute""
msgstr "die verwendete Einheit des Attributes"


#: geonode/layers/models.py:428
msgid "visible?"
msgstr "sichtbar?"
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 f640dca

Please sign in to comment.