def add_user_to_course(user, kraj_tecaja, kotizacija, prenosnik, majica): course_type = CourseType.query(CourseType.title == "SmartNinja Vikend Slovenia").get() if not course_type: course_type = CourseType() course_type.title = "SmartNinja Vikend Slovenia" course_type.put() course = None price = [97.00, 147.00, 197.00] if kraj_tecaja == "Ljubljana": course = Course.query(Course.title == "SmartNinja Vikend Ljubljana").get() if not course: course = Course.create(title="SmartNinja Vikend Ljubljana", city="Ljubljana", start_date=datetime.date(2015, 2, 7), end_date=datetime.date(2015, 2, 8), description="", price=price, place="", course_type=course_type.get_id, currency="EUR", spots=10) elif kraj_tecaja == "Maribor": course = Course.query(Course.title == "SmartNinja Vikend Maribor").get() if not course: course = Course.create(title="SmartNinja Vikend Maribor", city="Maribor", start_date=datetime.date(2015, 2, 14), end_date=datetime.date(2015, 2, 15), description="", price=price, place="", course_type=course_type.get_id, currency="EUR", spots=10) elif kraj_tecaja == "NovaGorica": course = Course.query(Course.title == "SmartNinja Vikend Nova Gorica").get() if not course: course = Course.create(title="SmartNinja Vikend Nova Gorica", city="Nova Gorica", start_date=datetime.date(2015, 2, 28), end_date=datetime.date(2015, 3, 1), description="", price=price, place="", course_type=course_type.get_id, currency="EUR", spots=10) if course: course_app = CourseApplication.create(course_title=course.title, course_id=course.get_id, student_name=user.get_full_name, student_id=user.get_id, student_email=user.email, price=kotizacija, currency="EUR", laptop=prenosnik, shirt=majica) course.taken += 1 course.put()
def add_user_to_course(user, kraj_tecaja, kotizacija, prenosnik, majica): course_type = CourseType.query( CourseType.title == "SmartNinja Vikend Slovenia").get() if not course_type: course_type = CourseType() course_type.title = "SmartNinja Vikend Slovenia" course_type.put() course = None price = [97.00, 147.00, 197.00] if kraj_tecaja == "Ljubljana": course = Course.query( Course.title == "SmartNinja Vikend Ljubljana").get() if not course: course = Course.create(title="SmartNinja Vikend Ljubljana", city="Ljubljana", start_date=datetime.date(2015, 2, 7), end_date=datetime.date(2015, 2, 8), description="", price=price, place="", course_type=course_type.get_id, currency="EUR", spots=10) elif kraj_tecaja == "Maribor": course = Course.query( Course.title == "SmartNinja Vikend Maribor").get() if not course: course = Course.create(title="SmartNinja Vikend Maribor", city="Maribor", start_date=datetime.date(2015, 2, 14), end_date=datetime.date(2015, 2, 15), description="", price=price, place="", course_type=course_type.get_id, currency="EUR", spots=10) elif kraj_tecaja == "NovaGorica": course = Course.query( Course.title == "SmartNinja Vikend Nova Gorica").get() if not course: course = Course.create(title="SmartNinja Vikend Nova Gorica", city="Nova Gorica", start_date=datetime.date(2015, 2, 28), end_date=datetime.date(2015, 3, 1), description="", price=price, place="", course_type=course_type.get_id, currency="EUR", spots=10) if course: course_app = CourseApplication.create(course_title=course.title, course_id=course.get_id, student_name=user.get_full_name, student_id=user.get_id, student_email=user.email, price=kotizacija, currency="EUR", laptop=prenosnik, shirt=majica) course.taken += 1 course.put()