#NEWLINE# @ api . route ( '/classes/<int:id>/registrations/' , methods = [ 'POST' ] ) #NEWLINE# @ json #NEWLINE# def new_class_registration( id ) : #NEWLINE# #INDENT# class_ = Class . query . get_or_404 ( id ) #NEWLINE# data = request . get_json ( force = True ) #NEWLINE# data [ 'class_url' ] = class_ . get_url ( ) #NEWLINE# reg = Registration ( ) . import_data ( id ) #NEWLINE# db . session . add ( reg ) #NEWLINE# db . session . commit ( ) #NEWLINE# return ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , 201 , { #NEWLINE# #INDENT# 'Location' : reg . get_url ( ) , #NEWLINE# #UNINDENT# } )