Skip to content

Commit

Permalink
mostrando quantidade covidado
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocintra committed Jul 5, 2017
1 parent 719bc2d commit d4d96bd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/templates/core/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Confirma Presença</a>
<a class="navbar-brand" href="{% url 'index' %}">Confirma Presença</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li class="active"><a href="{% url 'index' %}">Home</a></li>
<li><a href="#about">Sobre</a></li>
<li><a href="#contact">Contato</a></li>
{% if user.is_authenticated %}
Expand Down
5 changes: 4 additions & 1 deletion core/templates/core/convidados_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ <h1><i class="fa fa-user-md" aria-hidden="true"></i> Convidados <small>Exibindo
</a>
</div>
<div class="row">

<h4>Quantidade de pessoas: {{ quantidade_confirmada }}</h4>

{% if convidados_list %}
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Convidado</th>
<th>Quantidade</th>
<th>Data Cadastro</th>
<th>Data da Confirmação</th>
</tr>
</thead>
<tbody>
Expand Down
6 changes: 6 additions & 0 deletions core/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.messages.views import SuccessMessageMixin
from django.db.models import Sum
from django.views.generic import TemplateView, ListView, UpdateView, DeleteView
from django.views.generic.edit import CreateView
from .models import Convidado
Expand All @@ -20,6 +21,11 @@ class ConvidadoList(LoginRequiredMixin, ListView):
template_name = 'core/convidados_list.html'
context_object_name = 'convidados_list'

def get_context_data(self, **kwargs):
context = super(ConvidadoList, self).get_context_data(**kwargs)
context['quantidade_confirmada'] = Convidado.objects.aggregate(Sum('quantidade_convidados')).get('quantidade_convidados__sum', 0)
return context


index = IndexView.as_view()
convidado_list = ConvidadoList.as_view()
Binary file modified db.sqlite3
Binary file not shown.

0 comments on commit d4d96bd

Please sign in to comment.