class Course(models.Model):
students = models.ManyToManyField(User, verbose_name='Students', null=True, blank=True)
I want to add course enrollment to model Course but my manytomanyfield already has all the users and I can't even remove any of them. What should I do? I want "Students" to be a list of users who takes the course.
CodePudding user response:
No! The student named (references to the student objects) are listed there as options of a multiple select widget but they are not actually selected. To select students for the course you would hold down the control key and click and the appropriate student’s names (control key on windows) . You could also just click on a single student’s name in a case where it’s a single student course .
And if you are worried about the admin page displaying all the users at once, trying looking at the django-autocomplete app here is the link to their pypi page Django-Autocomplete-light app