Skip to content

Commit

Permalink
Merge pull request #71 from oarepo/krist/editable-field-default-value
Browse files Browse the repository at this point in the history
Krist/editable field default value
  • Loading branch information
mesemus authored Oct 18, 2024
2 parents 51a4340 + 2aa7017 commit 2a6f73d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion oarepo_requests/types/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class OARepoRequestType(RequestType):
description = None

dangerous = False
editable = True

@classmethod
@property
Expand All @@ -30,6 +29,11 @@ def available_statuses(cls):
def has_form(cls):
return hasattr(cls, "form")

@classmethod
@property
def editable(cls):
return cls.has_form

def can_create(self, identity, data, receiver, topic, creator, *args, **kwargs):
current_requests_service.require_permission(
identity, "create", record=topic, request_type=self, **kwargs
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = oarepo-requests
version = 2.2.1
version = 2.2.2
description =
authors = Ronald Krist <[email protected]>
readme = README.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def test_ui_serialization(
{
"dangerous": True,
"description": "Request deletion of draft",
"editable": True,
"editable": False,
"has_form": False,
"links": {
"actions": {
Expand Down Expand Up @@ -279,7 +279,7 @@ def test_ui_serialization(
"description": "Request deletion of published record",
"name": "Delete record",
"dangerous": True,
"editable": True,
"editable": False,
"has_form": False,
"stateful_description": "Request permission to delete the record.",
"stateful_name": "Request record deletion",
Expand All @@ -294,7 +294,7 @@ def test_ui_serialization(
"description": "Request re-opening of published record",
"name": "Edit record",
"dangerous": False,
"editable": True,
"editable": False,
"has_form": False,
"stateful_description": "Click to start editing the metadata of the record.",
"stateful_name": "Edit record",
Expand All @@ -309,7 +309,7 @@ def test_ui_serialization(
"description": "Request requesting creation of new version of a published record.",
"name": "New Version",
"dangerous": False,
"editable": True,
"editable": False,
"has_form": False,
"stateful_description": "Click to start creating a new version of the "
"record.",
Expand Down

0 comments on commit 2a6f73d

Please sign in to comment.