diff --git a/opac/webapp/admin/views.py b/opac/webapp/admin/views.py index 1ac60e14..df611e2e 100644 --- a/opac/webapp/admin/views.py +++ b/opac/webapp/admin/views.py @@ -483,9 +483,11 @@ def handle_view_exception(self, exc): class CollectionAdminView(OpacBaseAdminView): + can_create = True can_edit = True edit_modal = True - form_excluded_columns = ("acronym", "metrics") + can_delete = True + form_excluded_columns = ("metrics") column_exclude_list = [ "_id", "about", @@ -522,6 +524,11 @@ class CollectionAdminView(OpacBaseAdminView): inline_models = (InlineFormAdmin(Sponsor),) + def on_model_change(self, form, model, is_created): + # é necessario definir um valor para o campo ``_id`` na criação. + if is_created: + model._id = str(uuid4().hex) + class JournalAdminView(OpacBaseAdminView): can_edit = True