if i have three models:
Class
name
date
Student
class # fk to Class
Credit
student # fk to Student
class # fk to Class
a Student can be enrolled in a Class
a Credit is associated with a specific class and is assigned to a student.
The ClassAdmin has two inlines:
StudentInline shows who all is enrolled in the class.
CreditInline shows all the credits for the class (basically, who actually showed up)
my issue is this:
the default functionality is to only show Credits in the CreditInline that actually exist.
and you can add “extras” that will let the user add more.
however. i would like to show a row in the CreditInline for each student that is enrolled whether they already have a credit or not.
i would need to dynamically determine the number of extra forms based on the number of credits that already exist. and then pre fill out the initial value for the student field for those extras with whatever students do not already have a credit stored in the db.
and then sort them alphabetically of course… lol.
not sure if it is better to try and do this through the model admin. or if i just need to create a custom template. i’m not immediately seeing a straightforward way to add initial values to the extra forms on an inline.
thanks.