jquery - Passing data to bootstrap modal Django template -
the view passes list of elements template, example list of movies, , rendered in table. , each element has detail , 1 specific element has list. content of list wanna put them inside modal. i'm doing 2 loops following:
<table> <thead> <tr> <td>title</td> <td>description</td> <td>hours</td> </tr> </thead> <tbody> {% key in movies %} <tr> <td>{{ key.title }}</td> <td>{{ key.description }}</td> <td> <!--this button calls modal--> {% hour in key.hours %} <li>{{ hour }}</li> {% endfor %} <button type="button" class="btn btn-default" data-toggle="modal" data-target="#mymodal"></button> </td> </tr> {% endfor %} </tbody> </table>
my modal under table outside div wraps table. pass values of second loop modal. , when user clicks on button values appear inside modal.
how can this?
you have 2 choices
you can use javascript change contents of modal when button clicked.
instead of 1 modal, create 1 modal each movie hours. depending on button click, different modal gets opened.
Comments
Post a Comment