def create_mode(request, course_id):
 PARAMETERS = {'mode_slug': u'honor', 'mode_display_name': u'Honor Code Certificate', 'min_price': 0, 'suggested_prices': u'', 'currency': u'usd'}
 for (parameter, default) in PARAMETERS.iteritems():
  PARAMETERS[parameter] = request.GET.get(parameter, default)
 course_key = CourseKey.from_string(course_id)
 CourseMode.objects.get_or_create(course_id=course_key, **PARAMETERS)
 return HttpResponse("Mode '{mode_slug}' created for '{course}'.".format(mode_slug=PARAMETERS['mode_slug'], course=course_id))

def create_mode ( request , course_id ) : PARAMETERS = { 'mode_slug' : u'honor' , 'mode_display_name' : u'Honor Code Certificate' , 'min_price' : 0 , 'suggested_prices' : u'' , 'currency' : u'usd' } for ( parameter , default ) in PARAMETERS . iteritems ( ) : PARAMETERS [ parameter ] = request . GET . get ( parameter , default ) course_key = CourseKey . from_string ( course_id ) CourseMode . objects . get_or_create ( course_id = course_key , ** PARAMETERS ) return HttpResponse ( "Mode '{mode_slug}' created for '{course}'." . format ( mode_slug = PARAMETERS [ 'mode_slug' ] , course = course_id ) )
add a mode to the course corresponding to the given course id .