I am new to Django, and I am trying to create a multiple selection with checkboxes. The problem is that all of the examples that I found have fixed choices that are specified in the form, and I don't need that.
More concretely, let this be a model for a simple car dealership app:
class CarBrand(models.Model):
name = model.CharField()
class CarModel(models.Model):
name = model.CharField()
brand = model.ForeignKey(CarBrand)
My goal is when I enter the page for Audi, I get options A3, A4, A5, but when I enter the page for BMW, I get options M3, M4, M5. After clicking the submit it should send all the car models that were selected.