Prettier display

This commit is contained in:
Hugo LEVY-FALK 2018-12-14 18:25:26 +01:00
parent 1d08459618
commit a2b7b45327
4 changed files with 49 additions and 52 deletions

View file

@ -30,8 +30,7 @@
<nav id="nav">
<ul>
<li class="current"><a href="{% url 'index' %}">Home</a></li>
<li><a href="">Imprimer</a></li>
<li><a href="">Comptes</a></li>
<li><a href="{% url 'search' %}">Imprimer</a></li>
</ul>
</nav>
@ -39,9 +38,11 @@
<section id="main">
<div class="container">
<div class="row gtr-200">
<div class="col-12">
<div class="col-2"></div>
<div class="col-8">
{% block content %}{% endblock %}
</div>
<div class="col-2"></div>
</div>
</div>
</section>
@ -49,39 +50,6 @@
<!-- Footer -->
<footer id="footer">
<div class="container">
<div class="row gtr-200">
<div class="col-12">
<!-- About -->
<section>
<h2 class="major"><span>What's this about?</span></h2>
<p>
This is <strong>TXT</strong>, yet another free responsive site template designed by
<a href="http://twitter.com/ajlkn">AJ</a> for <a href="http://html5up.net">HTML5 UP</a>. It's released under the
<a href="http://html5up.net/license/">Creative Commons Attribution</a> license so feel free to use it for
whatever you're working on (personal or commercial), just be sure to give us credit for the design.
That's basically it :)
</p>
</section>
</div>
<div class="col-12">
<!-- Contact -->
<section>
<h2 class="major"><span>Get in touch</span></h2>
<ul class="contact">
<li><a class="icon fa-facebook" href="#"><span class="label">Facebook</span></a></li>
<li><a class="icon fa-twitter" href="#"><span class="label">Twitter</span></a></li>
<li><a class="icon fa-instagram" href="#"><span class="label">Instagram</span></a></li>
<li><a class="icon fa-dribbble" href="#"><span class="label">Dribbble</span></a></li>
<li><a class="icon fa-linkedin" href="#"><span class="label">LinkedIn</span></a></li>
</ul>
</section>
</div>
</div>
<!-- Copyright -->
<div id="copyright">
<ul class="menu">

View file

@ -1,10 +1,11 @@
{% extends 'account/base.html' %}
{% block content %}
{% if title %}<h1>{{ title }}</h1>{% endif %}
<form action="" method="post">
{% csrf_token %}
{{ form }}
<br/>
<input type="submit" value="Envoyer">
<input type="submit" value="{{ submit|default:"Envoyer" }}">
</form>
{% endblock %}

View file

@ -1,11 +1,12 @@
{% extends 'account/base.html' %}
{% block content %}
<h1>Rechercher un compte</h1>
<form action="" method="post">
{% csrf_token %}
{{ form }}
<br/>
<input type="submit" value="Envoyer">
<input type="submit" value="Chercher">
</form>
<table>
<tr>

View file

@ -26,7 +26,12 @@ def refill_balance(request, pk):
return render(
request,
'account/form.html',
locals()
{
'account': account,
'form': form,
'title': "Recharge du solde",
'submit': "Recharger"
}
)
@login_required
@ -45,15 +50,20 @@ def pay(request, pk):
return render(
request,
'account/form.html',
locals()
{
'account': account,
'form': form,
'title': "Paiement d'une impression",
'submit': "Payer"
}
)
@login_required
def reset_balance(request, pk):
account = get_object_or_404(Account, pk=pk)
account.calc_balance()
if request.POST:
account.calc_balance()
sale = Sale()
sale.price = - account.balance
sale.title = "Remise à zéro du solde."
@ -62,11 +72,17 @@ def reset_balance(request, pk):
account.calc_balance()
account.save()
return redirect(reverse('index'))
elif account.balance is 0:
return redirect(reverse('index'))
return render(
request,
'account/form.html',
locals()
{
'account': account,
'title': "Rendre {}".format(account.balance),
'submit': "Argent rendu"
}
)
@login_required
@ -80,27 +96,30 @@ def create_account(request):
return render(
request,
'account/form.html',
locals()
{
'form': form,
'title': "Créer un compte",
'submit': "Créer"
}
)
@login_required
def search(request):
form = SearchForm(request.POST or None)
accounts = Account.objects.order_by('firstname')
if form.is_valid():
string = form.cleaned_data['search']
accounts = Account.objects.filter(firstname__istartswith=string)\
| Account.objects.filter(lastname__istartswith=string)\
| Account.objects.filter(email__istartswith=string)
return render(
request,
'account/list_accounts.html',
locals()
)
accounts = Account.objects.order_by('firstname')
return render(
request,
'account/list_accounts.html',
locals()
{
'accounts': accounts,
'form': form,
}
)
@login_required
@ -122,7 +141,11 @@ def article(request, pk):
return render(
request,
'account/form.html',
locals()
{
'form': form,
'submit': "Éditer",
'title': "Édition d'un article"
}
)
@login_required
@ -134,7 +157,11 @@ def new_article(request):
return render(
request,
'account/form.html',
locals()
{
'form': form,
'submit': "Créer",
'title': "Création d'un article"
}
)
@login_required