Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #195 feature dataset attribute requiring a unit entry #197

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)."
),
),
]
Loading