Created
June 23, 2015 18:18
-
-
Save edgabaldi/0a460a7c4e2b6ea7f23a to your computer and use it in GitHub Desktop.
Custom template example of ModelFormSetView (django-extra-views)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% extends 'agendamento/base_comitente.html' %} | |
| {% load bootstrap %} | |
| {% block extra_css %} | |
| <style> | |
| .form-actions{ | |
| padding:10px; | |
| background-color:#EEE; | |
| border-top:1px solid #CCC; | |
| } | |
| </style> | |
| {% endblock extra_css %} | |
| {% block content_comitente %} | |
| <h3>Cadastro de Categoria</h3> | |
| <form method="post">{% csrf_token %} | |
| {{ formset.management_form }} | |
| <table class="table table-bordered table-splited"> | |
| <tr> | |
| <th>Nome Categoria</th> | |
| <th>Pontos</th> | |
| <th>Excluir</th> | |
| </tr> | |
| {% for form in formset %} | |
| <tr> | |
| <td>{{form.nome_categoria}}</td> | |
| <td>{{form.pontos}}</td> | |
| <td>{{form.DELETE}}{{form.id}}</td> | |
| </tr> | |
| {% endfor %} | |
| </table> | |
| <div class="form-group form-actions"> | |
| <button class="btn btn-success">Salvar</button> | |
| </div> | |
| </form> | |
| {% endblock content_comitente %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from extra_views import ModelFormSetView | |
| class CapacidadeCategoriaFormSetView(ModelFormSetView): | |
| model=CapacidadeCategoria | |
| template_name='agendamento/capacidadecategoria_form.html' | |
| can_delete=True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can_delete=Truedidn't work for me. Had to use :