Hello,
I’m working on a gradebook app. Some pseudocode for my models looks like:
class Course
name
class Section
name
course = models.ForeignKey(Course)
class Student
name
section = models.ForeignKey(Section)
grade
If I want to enter in a grade for students, first I would select the course, then the section in the course, and I would then get a list of students where I can now enter in the grade. I can only think of two ways to do this.
- HTML only, use separate views/forms/templates for each step. template/Form1 selects the course and I redirected a new page/template/form with a choice of sections. Select the section I want and then I’m directed to a template/view/form where I enter in the grade.
- Have one template/view/form but use some javascript to hide parts of the form based on selections. Ex. The form would have all the courses, sections and students but the sections and students are hidding. Selecting a course button reveals the relevent sections and selecting section buttons reveals students. I don’t know if this actually works because you’d end up with most students having empty data in the form. Maybe some javascript can make an empty box be ignored or something like that.
I also guess that method #2 is not very efficient. While many teachers would have a maximum of 200 students, there could be a teacher that is assigned to grade level courses and end up with maybe 2000 students.
I think I need to do this type of task in many scenarios with this app. I also think this must be a very common problem in working with django and other web apps, where the user has to weave down through a series of selections.
I’m hoping someone can offer some insight into strategies for accomplishing this. Thanks.