fix: cleanup Group views to better match farmOS

This commit is contained in:
Lance Edgar 2026-02-14 20:06:09 -06:00
parent 5e4cd8978d
commit aae01c010b

View file

@ -38,10 +38,13 @@ class GroupView(WuttaFarmMasterView):
farmos_refurl_path = "/assets/group" farmos_refurl_path = "/assets/group"
labels = {
"name": "Asset Name",
}
grid_columns = [ grid_columns = [
"drupal_id",
"name", "name",
"is_location",
"is_fixed",
"archived", "archived",
] ]
@ -54,10 +57,9 @@ class GroupView(WuttaFarmMasterView):
form_fields = [ form_fields = [
"name", "name",
"is_location",
"is_fixed",
"archived",
"notes", "notes",
"asset_type",
"archived",
"farmos_uuid", "farmos_uuid",
"drupal_id", "drupal_id",
] ]
@ -66,6 +68,9 @@ class GroupView(WuttaFarmMasterView):
g = grid g = grid
super().configure_grid(g) super().configure_grid(g)
# drupal_id
g.set_label("drupal_id", "ID", column_only=True)
# name # name
g.set_link("name") g.set_link("name")
@ -82,6 +87,13 @@ class GroupView(WuttaFarmMasterView):
# notes # notes
f.set_widget("notes", "notes") f.set_widget("notes", "notes")
# asset_type
if self.creating:
f.remove("asset_type")
else:
f.set_default("asset_type", "Group")
f.set_readonly("asset_type")
def get_farmos_url(self, group): def get_farmos_url(self, group):
return self.app.get_farmos_url(f"/asset/{group.drupal_id}") return self.app.get_farmos_url(f"/asset/{group.drupal_id}")