Ejemplo n.º 1
0
def inst_id_validate(request):
    if request.method == 'POST':
        try:
            VC1 = VEDACat(inst_code=request.POST['input_text'])
            data = VC1.validate_inst()
        except:
            data = ''
    else:
        data = ''

    return HttpResponse(json.dumps(data), content_type="application/json")
Ejemplo n.º 2
0
def institution_name(request):
    if request.method == 'POST' and request.POST['input_text'] != 'NEWINST':
        inst_code = request.POST['input_text']
        VC1 = VEDACat(inst_code=inst_code)
        institution_name = VC1.institution_name()

    else:
        institution_name = ''

    return HttpResponse(json.dumps(institution_name),
                        content_type="application/json")
Ejemplo n.º 3
0
def course_add(request):
    if request.method == 'POST':
        return_data = request.POST['return_data']

        VC1 = VEDACat()
        course_data = VC1.course_add(return_data=return_data)
    else:
        course_data = ''

    return HttpResponse(json.dumps(course_data),
                        content_type="application/json")
Ejemplo n.º 4
0
def course_id_validate(request):

    if request.method == 'POST' and 'edx_classid' in request.POST:
        inst_code = request.POST['institution']
        course_code = request.POST['edx_classid']

        VC1 = VEDACat(inst_code=inst_code[0:3])
        data = VC1.validate_code(course_code=course_code[0:5])

    else:
        data = False

    return HttpResponse(json.dumps(data), content_type="application/json")
Ejemplo n.º 5
0
def institution_name(request):
    if request.method == 'POST' and request.POST['input_text'] != 'NEWINST':
        inst_code = request.POST['input_text']
        print inst_code
        VC1 = VEDACat(inst_code=inst_code)
        institution_name = VC1.institution_name()

    else:
        institution_name = ''

    return HttpResponse(
        json.dumps(institution_name), 
        content_type="application/json"
        )
Ejemplo n.º 6
0
def input_form(request):
    if not request.user.is_authenticated():
        return HttpResponseRedirect('/admin/login/?next=%s' % request.path)

    VC1 = VEDACat()
    VC1.institution_list()

    inst_list = json.dumps(VC1.inst_list)

    template = loader.get_template('course_form.html')
    context = RequestContext(request, ({ 
        'institution_list' : inst_list
        }))
    return HttpResponse(template.render(context))
Ejemplo n.º 7
0
def inst_id_validate(request):
    if request.method == 'POST':
        try:
            VC1 = VEDACat(inst_code=request.POST['input_text'])
            data = VC1.validate_inst()
        except:
            data = ''
    else:
        data = ''

    return HttpResponse(
        json.dumps(data),
        content_type="application/json"
        )
Ejemplo n.º 8
0
def input_form(request):
    """
    Course Addition Tool Endpoints
    """
    if not request.user.is_authenticated():
        return HttpResponseRedirect('/admin/login/?next=%s' % request.path)

    VC1 = VEDACat()
    VC1.institution_list()

    inst_list = json.dumps(VC1.inst_list)

    template = loader.get_template('course_form.html')
    context = RequestContext(request, ({'institution_list': inst_list}))
    return HttpResponse(template.render(context))
Ejemplo n.º 9
0
def course_add(request):
    if request.method == 'POST':
        return_data = request.POST['return_data']

        VC1 = VEDACat()
        course_data = VC1.course_add(
            return_data=return_data
            )
    else:
        course_data = ''

    return HttpResponse(
        json.dumps(course_data),
        content_type="application/json"
        )
Ejemplo n.º 10
0
def course_id_validate(request):

    if request.method == 'POST' and 'edx_classid' in request.POST:
        inst_code = request.POST['institution']
        course_code = request.POST['edx_classid']

        VC1 = VEDACat(inst_code=inst_code[0:3])
        data = VC1.validate_code(course_code=course_code[0:5])

    else:
        data = False

    return HttpResponse(
        json.dumps(data),
        content_type="application/json"
        )
Ejemplo n.º 11
0
class TestVariables(TestCase):
    def setUp(self):
        self.VCT = VEDACat()

    def test_config(self):
        self.assertTrue(len(self.VCT.veda_model) > 0)

    def test_institution_valid(self):
        self.VCT.inst_code = '111'
        self.assertTrue(self.VCT.institution_name() == 'Error')
Ejemplo n.º 12
0
class TestVariables(unittest.TestCase):

    def setUp(self):
        self.VCT = VEDACat()

    def test_config(self):
        self.assertTrue(len(self.VCT.veda_model) > 0)

    def test_institution_valid(self):
        self.VCT.inst_code = '111'
        self.assertTrue(self.VCT.institution_name() == 'Error')
Ejemplo n.º 13
0
def institution_data(request):
    # if request.method != 'POST':
    #     return HttpResponse(
    #         json.dumps('NEWINST'),
    #         content_type="application/json"
    #         )
    inst_code = request.POST['inst_code']
    print inst_code
    if inst_code != 'NEWINST':
        VC1 = VEDACat(inst_code=inst_code[0:3])

    else:
        VC1 = VEDACat(inst_code=inst_code)

    VC1.institution_data()
    data = VC1.return_fields

    return HttpResponse(
        json.dumps(data),
        content_type="application/json"
        )
Ejemplo n.º 14
0
def institution_data(request):
    inst_code = request.POST['inst_code']
    if inst_code != 'NEWINST':
        VC1 = VEDACat(inst_code=inst_code[0:3])

    else:
        VC1 = VEDACat(inst_code=inst_code)

    VC1.institution_data()
    data = VC1.return_fields

    return HttpResponse(json.dumps(data), content_type="application/json")
Ejemplo n.º 15
0
 def setUp(self):
     self.VCT = VEDACat()
Ejemplo n.º 16
0
 def setUp(self):
     self.VCT = VEDACat()