select option on same table row as radio button does not work

I stumbled on a strange behaviour of django. I have a table with a radio button selection and on the same row a dropdown which is filled from a postgress table. Although all fields in the row are correctly rendered, the dropdown is not. Whichever row is selected, the option of the dropdown of the last row is taken. Is it not possible to combine radio button and dropdown on the sqme row in a table?

        {% for row in rgb_rows %}
  <tr>
       <td>
            <div class="form-check">
                <input class="form-check-input" type="radio" name="selected_tshirt" value="{{row.0}}/{{row.4}}" {% if selected_tshirt == row.0 %}checked{% endif %}>
            </div>
       </td>
       <td data-bs-toggle="tooltip" data-bs-placement="top"c title="{{row.5}}">{{ row.1 }}</td>
      <td>{{ row.2 }}</td>
      <td>{{ row.3 }}</td>
      <td> <button type="button"  class="btn btn-primary" style="background-color:{{ row.4 }}" ></button></td>
      <td>
            <select class="form-select form-select-lg mb-3"  name="selected_size">
                      {% for row in size_rows %}
             <option value="{{row.1}}" {% if selected_size == row.1 %} selected {% endif %}>{{row.1}}</option>
                     {% endfor %}
            </select>

     </td>
   </tr>
       {% endfor %}
 

The problem you have here is that every row is using the same name attribute for the drop-down. You don’t have anything in the HTML to identify which row a particular select element is associated with.

Actually, what you really have here is a typical case for using a Django formset.

thanks for the tip, but in this case I just put the size in a separate row.

formset is indeed the best way but too much trouble right now. Need to study it first.