Skip to content

Commit

Permalink
fix excluded no project attributes for Draft Registration
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tordoff committed Sep 26, 2023
1 parent 04fe820 commit 7414593
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion osf/models/registrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,9 +1261,12 @@ def create_from_node(cls, user, schema, node=None, data=None, provider=None):
else:
provider.validate_schema(schema)

excluded_attributes = []
if not node:
# If no node provided, a DraftNode is created for you
node = DraftNode.objects.create(creator=user, title=settings.DEFAULT_DRAFT_NODE_TITLE)
# Force the user to add their own title for no-project
excluded_attributes.append('title')

if not (isinstance(node, Node) or isinstance(node, DraftNode)):
raise DraftRegistrationStateError()
Expand All @@ -1279,7 +1282,7 @@ def create_from_node(cls, user, schema, node=None, data=None, provider=None):
draft.copy_editable_fields(
node,
save=True,
excluded_attributes=['title'] # Force the user to add their own title for no-project
excluded_attributes=excluded_attributes
)
draft.update(data, auth=Auth(user))

Expand Down

0 comments on commit 7414593

Please sign in to comment.