[Fixed]-Use django admin to save a list of selected objects to another table

1đź‘Ť

âś…

What you’re going to want to do here is set up your Patient and Medication models (if you have them) to be linked to each other using Django’s ManyToManyField, ForeignKey, or OneToOneField systems in your models.py. So for example, a Patient model could have a one-to-many, many-to-many, or one-to-one relationship with the Medication model, depending on how you personally would like to have your project set up.

When doing this, if you want to see/create patients and medications in your admin interface, you could simply do admin.site.register(Patient) or admin.site.register(Medication) in your admin.py, of course not forgetting to import them first.

👤sidp

Leave a comment