Beispiel #1
0
def createsubject(response):
    if (not response.get_field("subjectname") or
        not response.get_field("subject") or 
        not response.get_field("unit") or 
        not response.get_field("description")):
        template.render_template("templates/subject_create_template.html",
                                {"notification":"One or more of the fields are missing!","user":'',"enablebutton":True},
                                response)
    else:
        subjectname = response.get_field("subjectname")
        subjectunits = response.get_field("unit")
        subjectdescription = response.get_field("description")
        subjectcategory = response.get_field("subject")
        database_subject.create_subject(subjectname,subjectcategory,subjectunits,subjectdescription)
        response.write("Saved")
Beispiel #2
0
def createpage(response):
	
	if auth.get_user(response):
		
		if (not response.get_field("name") or
			not response.get_field("KLA") or 
			not response.get_field("grade") or 
			not response.get_field("jurisdiction") or 
			not response.get_field("description")):
			template.render_template("templates/subject_create_template.html",
									 {"notification":
										  "One or more of the fields are missing! ","enablebutton":True},
									 response)
		else:
			name = response.get_field("name")       
			KLA = response.get_field("KLA")
			grade = response.get_field("grade")
			jurisdiction = response.get_field("jurisdiction")
			description = response.get_field("description")
			database_subject.create_subject(name,KLA,grade,jurisdiction,description)
			response.write("Saved")
	else:
		response.redirect("/")