Skip to content

Commit

Permalink
mostrando listagem de convidados
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocintra committed Jul 5, 2017
1 parent d558654 commit 719bc2d
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
1 change: 1 addition & 0 deletions confirma/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^convidados/', views.convidado_list, name='convidados'),
url(r'^admin/', admin.site.urls),
]

Expand Down
3 changes: 3 additions & 0 deletions core/templates/core/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">Sobre</a></li>
<li><a href="#contact">Contato</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'convidados' %}">Convidados</a></li>
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">

Expand Down
38 changes: 38 additions & 0 deletions core/templates/core/convidados_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% extends "core/base.html" %}

{% block content %}
<div class="page-header">
<h1><i class="fa fa-user-md" aria-hidden="true"></i> Convidados <small>Exibindo convidados cadastrados</small></h1>
</div>
<div class="row" style="padding-bottom: 20px;">
<a href="{% url 'index' %}" class="btn btn-success">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Adicionar Convidados
</a>
</div>
<div class="row">
{% if convidados_list %}
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Convidado</th>
<th>Quantidade</th>
<th>Data Cadastro</th>
</tr>
</thead>
<tbody>
{% for convidado in convidados_list %}
<tr>
<th>{{ convidado.id }}</th>
<th>{{ convidado.nome_convidado }}</th>
<th>{{ convidado.quantidade_convidados }}</th>
<th>{{ convidado.data_cadastro }}</th>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<h2>Nenhum convidado cadastrado ainda</h2>
{% endif %}
</div>
{% endblock content %}
7 changes: 5 additions & 2 deletions core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class IndexView(SuccessMessageMixin, CreateView):


class ConvidadoList(LoginRequiredMixin, ListView):
pass
model = Convidado
template_name = 'core/convidados_list.html'
context_object_name = 'convidados_list'


index = IndexView.as_view()
index = IndexView.as_view()
convidado_list = ConvidadoList.as_view()

0 comments on commit 719bc2d

Please sign in to comment.