Skip to content

Commit

Permalink
Merge pull request #158 from samuelveigarangel/issue-156
Browse files Browse the repository at this point in the history
Habilita Criação, Edição e Remoção de Notícias na área administrativa
  • Loading branch information
robertatakenaka authored Aug 30, 2024
2 parents 253b097 + 78ae65a commit c60b73d
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 c60b73d

Please sign in to comment.