I've created a django project to track medications at work. Using modelformset factory, I've created a form that allows the user to document the amount of each medication on the same form. For example, Drug 1, Drug 2, and Drug 3 are all listed on the same form and the user needs to enter the total amount of mg for each drug. When submitted, the entry creates a separate database record for each drug with the same datetime. I have created a query page that lists all the entries. I would like for the query to combine all the entries that share the same datetime, but I cannot figure this out. Does anyone have any suggestions? Thanks so much.