class Course(ndb.Model): ''' Course Object ''' "Eg: 14531, 09864" course_id = ndb.IntegerProperty() name = ndb.StringProperty() department = ndb.KeyProperty(kind=Department) instructor = ndb.StringProperty() # values are time ranges. E.g: "9:30am - noon" Since this is going to be only for viewing and not processing, string will suffice. time = ndb.StringProperty() place = ndb.StringProperty()
class Student(ndb.Model): ''' Student Object ''' # Ideally a student ID is best a String and not a number and it can be a combination of dept,batch and rollno. #For simplicity, it is set an integer. # Implicitly setting this varibale as the key student_id = ndb.IntegerProperty() name = ndb.StringProperty() address = ndb.StringProperty() phone_number = ndb.IntegerProperty() # Parent - Child relationship to retrieve department name department = ndb.KeyProperty(kind=Department) #department_name = ndb.KeyProperty(kind = Department) # similar to an array. study list can be list of things to study for a student study_lists = ndb.KeyProperty(kind=Course, repeated=True)
class Department(ndb.Model): department_id = ndb.IntegerProperty() name = ndb.StringProperty()