Skip to content

Commit

Permalink
Habilita criacao, edicao e delete de noticias
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelveigarangel committed Aug 9, 2024
1 parent 84ebfc8 commit 78ae65a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions opac/webapp/admin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,9 @@ def is_accessible(self):


class NewsAdminView(OpacBaseAdminView):
can_create = False
can_edit = False
can_delete = False
can_create = True
can_edit = True
can_delete = True
page_size = 30

def _url_formatter(self, context, model, name):
Expand All @@ -429,6 +429,11 @@ def _preview_formatter(self, context, model, name):
def _preview_date_format(self, context, model, name):
return custom_filters.datetimefilter(model.publication_date)

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)

column_formatters = {
"url": _url_formatter,
"image_url": _preview_formatter,
Expand Down

0 comments on commit 78ae65a

Please sign in to comment.