@must_have_permission(ADMIN)
@must_be_valid_project
def new_draft_registration(auth, node, *args, **kwargs):
 if node.is_registration:
  raise HTTPError(http.FORBIDDEN, data={'message_short': "Can't create draft", 'message_long': 'Creating draft registrations on registered projects is not allowed.'})
 data = request.values
 schema_name = data.get('schema_name')
 if (not schema_name):
  raise HTTPError(http.BAD_REQUEST, data={'message_short': 'Must specify a schema_name', 'message_long': 'Please specify a schema_name'})
 schema_version = data.get('schema_version', 2)
 meta_schema = get_schema_or_fail((Q('name', 'eq', schema_name) & Q('schema_version', 'eq', int(schema_version))))
 draft = DraftRegistration.create_from_node(node, user=auth.user, schema=meta_schema, data={})
 return redirect(node.web_url_for('edit_draft_registration_page', draft_id=draft._id))

@ must_have_permission ( ADMIN ) @ must_be_valid_project def new_draft_registration ( auth , node , * args , ** kwargs ) : if node . is_registration : raise HTTPError ( http . FORBIDDEN , data = { 'message_short' : "Can't create draft" , 'message_long' : 'Creating draft registrations on registered projects is not allowed.' } ) data = request . values schema_name = data . get ( 'schema_name' ) if ( not schema_name ) : raise HTTPError ( http . BAD_REQUEST , data = { 'message_short' : 'Must specify a schema_name' , 'message_long' : 'Please specify a schema_name' } ) schema_version = data . get ( 'schema_version' , 2 ) meta_schema = get_schema_or_fail ( ( Q ( 'name' , 'eq' , schema_name ) & Q ( 'schema_version' , 'eq' , int ( schema_version ) ) ) ) draft = DraftRegistration . create_from_node ( node , user = auth . user , schema = meta_schema , data = { } ) return redirect ( node . web_url_for ( 'edit_draft_registration_page' , draft_id = draft . _id ) )
create a new draft registration for the node :return: redirect to the new drafts edit page :rtype: flask .