Commit f78f0209 authored by root's avatar root

Big Fix pagination et syntaxe

parent 2e586888
......@@ -12,7 +12,6 @@
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="col-12">
<div class="thumbnail">
<div class="caption">
......@@ -21,7 +20,7 @@
<a href="{% url 'users:new-user' %}" class="btn btn-primary" role="button">Inscription</a></p>
</div>
</div>
</div>
</div>
<div class="col-12">
<div class="thumbnail">
<div class="caption">
......@@ -49,14 +48,13 @@
</div>
<div class="col-sm-6 col-md-4">
<div class="col-12">
<div class="thumbnail alert alert-warning">
<div role="alert">
<p><strong>Normale Soup' recrute !</strong> Si vous pensez avoir les nerfs assez solides pour répartir des paniers, les distribuer à des étudiants en manque de légumineuses et que vous pouvez venir nous aider quelques jeudis après-midi, inscrivez- vous à la mailing-list <a href="https://lists.crans.org/listinfo/amap-distributeurs" target="_blank">amap-distributeurs@lists.crans.org </a></p>
</div>
</div>
</div>
</div>
</div>
</div>
......
......@@ -30,7 +30,7 @@
{% endif %}
<h2>Commandes</h2>
<h2>Commandes</h2>
{% if paniers_list.paginator %}
<ul class="pagination nav navbar-nav">
......@@ -65,7 +65,7 @@
<th></th>
</tr>
</thead>
{% for panier in paniers_list %}
{% for panier in paniers_list %}
<tr>
<td>{{ panier.user.surname }}</td>
<td>{{ panier.user.name }}</td>
......@@ -77,8 +77,8 @@
{% else %}
<td><font color="red">Non</font></td>
{% endif %}
<td>{{ panier.date.date }}</td>
<td>{{ panier.date.date_modif }}</td>
<td>{{ panier.date.date }}</td>
<td>{{ panier.date.date_modif }}</td>
<td><div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="editioncredit" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Editer
......
......@@ -525,7 +525,7 @@ def index(request):
if next_livraison:
next_livraison_commandes = Commande.objects.filter(date=Livraison.objects.filter(date=next_livraison.date)).count()
next_livraison_paniers = sum(pan.coefficient_panier*pan.quantite for pan in Commande.objects.filter(date=Livraison.objects.filter(date=next_livraison.date)))
return render(request, 'panier/index.html', {'paniers_list': paniers_list, 'management_view': management_view, 'credit_list': credit_list, 'solde_total': solde_total, 'user_total': user_total, 'user_ens': user_ens, 'solde_moyen': solde_moyen, 'commandes_total': commandes_total, 'next_livraison': next_livraison, 'next_livraison_commandes': next_livraison_commandes, 'next_livraison_paniers': next_livraison_paniers})
return render(request, 'panier/index.html', {'page1': page1, 'page2': page2, 'paniers_list': paniers_list, 'management_view': management_view, 'credit_list': credit_list, 'solde_total': solde_total, 'user_total': user_total, 'user_ens': user_ens, 'solde_moyen': solde_moyen, 'commandes_total': commandes_total, 'next_livraison': next_livraison, 'next_livraison_commandes': next_livraison_commandes, 'next_livraison_paniers': next_livraison_paniers})
@login_required
def index_article(request):
......
......@@ -25,7 +25,7 @@
<th>Mail</th>
</tr>
</thead>
{% for user in users_list %}
{% for user in users_list %}
<tr>
<td><a href="{% url "users:profil" user.id%}" class="btn btn-primary btn-sm" role="button"><i class="glyphicon glyphicon-user"></i></a>
</td>
......@@ -38,10 +38,9 @@
<td><font color="red">Désactivé</font></td>
{% else %}
<td><font color="orange">Archivé</font></td>
{% endif %}
{% endif %}
<td>{{ user.telephone }}</td>
<td>{{ user.email }}</td>
</tr>
{% endfor %}
</table>
......
......@@ -68,7 +68,7 @@
<h2>Commandes et crédits</h2>
{% if is_bureau %}<a class="btn btn-primary btn-sm" role="button" href="{% url 'panier:add-credit' user.id %}"><i class="glyphicon glyphicon-piggy-bank"></i> Enregistrer un crédit</a>{% endif %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'panier:new-commande' user.id %}"><i class="glyphicon glyphicon-shopping-cart"></i> Nouvelle commande</a>
{#<a class="btn btn-primary btn-sm" role="button" href="{% url 'panier:add-credit-note' user.id %}"><i class="glyphicon glyphicon-piggy-bank"></i> Crédit par note Kfet</a>#}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'panier:add-credit-note' user.id %}"><i class="glyphicon glyphicon-piggy-bank"></i> Crédit par note Kfet</a>
{% if is_bureau %}<a class="btn btn-primary btn-sm" role="button" href="{% url 'panier:add-sac' user.id %}"><i class="glyphicon glyphicon-plus"></i> Ajouter un sac consigné</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'panier:del-sac' user.id %}"><i class="glyphicon glyphicon-minus"></i> Retirer un sac consigné</a>{% endif %}
<br/>
......
......@@ -293,9 +293,10 @@ def profil(request, userid):
credit_list = Credit.objects.filter(user=users).order_by('pk')
paginator_paniers = Paginator(paniers_list, PAGINATION_NUMBER)
paginator_credit = Paginator(credit_list, PAGINATION_NUMBER)
page = request.GET.get('page')
page1 = request.GET.get('page1')
page2 = request.GET.get('page2')
try:
paniers_list = paginator_paniers.page(page)
paniers_list = paginator_paniers.page(page1)
except PageNotAnInteger:
# If page is not an integer, deliver first page.
paniers_list = paginator_paniers.page(1)
......@@ -303,7 +304,7 @@ def profil(request, userid):
# If page is out of range (e.g. 9999), deliver last page of results.
paniers_list = paginator_paniers.page(paginator_paniers.num_pages)
try:
credit_list = paginator_credit.page(page)
credit_list = paginator_credit.page(page2)
except PageNotAnInteger:
# If page is not an integer, deliver first page.
credit_list = paginator_credit.page(1)
......@@ -329,14 +330,14 @@ def reset_password(request):
user = User.objects.get(pseudo=userform.cleaned_data['pseudo'],email=userform.cleaned_data['email'])
except User.DoesNotExist:
messages.error(request, "Cet utilisateur n'existe pas")
return form({'userform': userform}, 'users/user.html', request)
return form({'userform': userform}, 'users/user.html', request)
req = Request()
req.type = Request.PASSWD
req.user = user
req.save()
reset_passwd_mail(req, request)
messages.success(request, "Un mail pour l'initialisation du mot de passe a été envoyé")
redirect("/")
redirect("/")
return form({'userform': userform}, 'users/user.html', request)
def process(request, token):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment