Skip to content
Open
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
3 changes: 3 additions & 0 deletions admin_ui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@
"admin_required_to_view": False,
"draft_filter": filters.WebsiteFilter,
"published_filter": published_filters.WebsiteFilter,
"identifier_field": "title",
},
"WebsiteType": {},
"Image": {"identifier_field": "title"},
}

# defaults are assigned to each model in this comprehension, and then overwritten by the above dictionary
Expand All @@ -87,6 +89,7 @@
getattr(models, model_name)._meta.verbose_name_plural.replace(" ", "_")
),
"admin_required_to_view": True,
"identifier_field": "short_name",
**overrides,
}
for model_name, overrides in CUSTOM_MODEL_VALUES.items()
Expand Down
5 changes: 3 additions & 2 deletions admin_ui/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.contrib.gis.forms.fields import PolygonField
from django.forms import MultipleChoiceField, ModelChoiceField, DateField, DateInput
from django.utils.translation import gettext_lazy as _
from admin_ui.config import MODEL_CONFIG_MAP

from api_app import models
from data_models import models as data_models
Expand Down Expand Up @@ -48,9 +49,9 @@ def get_queryset_for_model(cls, dest_model):
return cls.get_queryset_for_collection_period()

dest_model_name = dest_model._meta.model_name

dest_model_class_name = dest_model._meta.object_name
# Field to use for textual description of field
identifier_field = {"image": "title", "website": "title"}.get(dest_model_name, "short_name")
identifier_field = MODEL_CONFIG_MAP[dest_model_class_name]['identifier_field']

return (
ChangeWithIdentifier("short_name")
Expand Down
4 changes: 4 additions & 0 deletions admin_ui/published_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class Meta:
}


class ImagePublishedTable(tables.Table):
pass


class IOPPublishedTable(tables.Table):
short_name = DraftLinkColumn(
viewname=f"{camel_to_snake('IOP')}-detail-published",
Expand Down
4 changes: 4 additions & 0 deletions admin_ui/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ class Meta(DraftTableBase.Meta):
sequence = ("short_name", "long_name")


class ImageChangeListTable:
pass


class IOPChangeListTable(DraftTableBase):
short_name = DraftLinkColumn(
update_viewname="change-diff",
Expand Down