{% for meds in resident.medication_set.all %} {% if forloop.first %} {{ meds.resident }}
{{ meds.resident.osca_id }} {{ meds.medicine.generic_name }} {% if meds.medicine.brand_name %}({{ meds.medicine.brand_name }}){% endif %} {{ meds.medicine.dosage }} {{ meds.frequency }} {% if meds.quantity %}{{ meds.quantity }}{% endif %} {% if meds.due %}{{ meds.due }}{% endif %} {% if meds.medicine.price %}{{ meds.medicine.price }}{% endif %} {% else %} {{ meds.medicine.generic_name }} {% if meds.medicine.brand_name %}({{ meds.medicine.brand_name }}){% endif %} {{ meds.medicine.dosage }} {{ meds.frequency }} {% if meds.quantity %}{{ meds.quantity }}{% endif %} {% if meds.due %}{{ meds.due }}{% endif %} {% if meds.medicine.price %}{{ meds.medicine.price }}{% endif %} {% endif %} {% endfor %}