@must_have_permission(ADMIN)
@must_be_branched_from_node
def update_draft_registration(auth, node, draft, *args, **kwargs):
 check_draft_state(draft)
 data = request.get_json()
 schema_data = data.get('schema_data', {})
 schema_data = rapply(schema_data, strip_html)
 schema_name = data.get('schema_name')
 schema_version = data.get('schema_version', 1)
 if schema_name:
  meta_schema = get_schema_or_fail((Q('name', 'eq', schema_name) & Q('schema_version', 'eq', schema_version)))
  existing_schema = draft.registration_schema
  if ((existing_schema.name, existing_schema.schema_version) != (meta_schema.name, meta_schema.schema_version)):
   draft.registration_schema = meta_schema
 draft.update_metadata(schema_data)
 draft.save()
 return (serialize_draft_registration(draft, auth), http.OK)

@ must_have_permission ( ADMIN ) @ must_be_branched_from_node def update_draft_registration ( auth , node , draft , * args , ** kwargs ) : check_draft_state ( draft ) data = request . get_json ( ) schema_data = data . get ( 'schema_data' , { } ) schema_data = rapply ( schema_data , strip_html ) schema_name = data . get ( 'schema_name' ) schema_version = data . get ( 'schema_version' , 1 ) if schema_name : meta_schema = get_schema_or_fail ( ( Q ( 'name' , 'eq' , schema_name ) & Q ( 'schema_version' , 'eq' , schema_version ) ) ) existing_schema = draft . registration_schema if ( ( existing_schema . name , existing_schema . schema_version ) != ( meta_schema . name , meta_schema . schema_version ) ) : draft . registration_schema = meta_schema draft . update_metadata ( schema_data ) draft . save ( ) return ( serialize_draft_registration ( draft , auth ) , http . OK )
update an existing draft registration :return: serialized draft registration :rtype: dict :raises: httperror .