Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
backoffice: have all fields available in search
Browse files Browse the repository at this point in the history
* ref: cern-sis/issues-inspire/issues/xxx
  • Loading branch information
karolina-siemieniuk-morawska authored and DonHaul committed Aug 28, 2024
2 parents 77ece53 + 40d6683 commit 3c8eef0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
17 changes: 17 additions & 0 deletions backoffice/backoffice/workflows/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ def has_delete_permission(self, request, obj=None):
}


class WorkflowsDecisionsInline(admin.StackedInline):
model = Decision
extra = 0
can_delete = False
show_change_link = True
readonly_fields = ["action_value", "_updated_at", "user"]

def has_change_permission(self, request, obj=None):
return False

@admin.display(description="action")
def action_value(self, obj):
return obj.action


@admin.register(Workflow)
class WorkflowAdmin(BaseModelAdmin):
"""
Expand All @@ -89,6 +104,8 @@ class WorkflowAdmin(BaseModelAdmin):
"_updated_at",
]

inlines = [WorkflowsDecisionsInline]


@admin.register(Decision)
class DecisionAdmin(BaseModelAdmin):
Expand Down
23 changes: 1 addition & 22 deletions backoffice/backoffice/workflows/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,7 @@
class WorkflowDocument(Document):
id = fields.TextField()
workflow_type = fields.KeywordField()
data = fields.ObjectField(
properties={
"ids": fields.ObjectField(
properties={
"value": fields.KeywordField(),
"schema": fields.KeywordField(),
}
),
"name": fields.ObjectField(
properties={
"value": fields.TextField(),
"preferred_name": fields.TextField(),
}
),
"email_address": fields.ObjectField(
properties={
"value": fields.KeywordField(),
"current": fields.BooleanField(),
}
),
}
)
data = fields.ObjectField(dynamic=True)

decisions = fields.NestedField(
properties={
Expand Down

0 comments on commit 3c8eef0

Please sign in to comment.