forked from DGNum/gestioCOF
Better scale management for order creation
+ Extends labels formatting of scale.
This commit is contained in:
parent
c11c3f84ed
commit
c0b8430a12
5 changed files with 14 additions and 8 deletions
|
@ -86,7 +86,10 @@ class Scale(object):
|
|||
def get_labels(self, label_fmt=None):
|
||||
if label_fmt is None:
|
||||
label_fmt = self.label_fmt
|
||||
return [begin.strftime(label_fmt) for begin, end in self]
|
||||
return [
|
||||
begin.strftime(label_fmt.format(i=i, rev_i=len(self)-i))
|
||||
for i, (begin, end) in enumerate(self)
|
||||
]
|
||||
|
||||
def chunkify_qs(self, qs, field=None):
|
||||
if field is None:
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{% load kfet_tags %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-8 col-md-offset-2 nopadding">
|
||||
{% include "kfet/base_messages.html" %}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
{% include 'kfet/base_messages.html' %}
|
||||
<div class="content-center">
|
||||
<form id='inventoryform' action="" method="post">
|
||||
<div class="table-responsive">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-condensed text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -77,7 +77,7 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{ formset.management_form }}
|
||||
{% if not perms.kfet.add_inventory %}
|
||||
<div class='auth-form form-horizontal'>
|
||||
|
|
|
@ -36,11 +36,9 @@
|
|||
<td rowspan="2">Commande</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>S1</td>
|
||||
<td>S2</td>
|
||||
<td>S3</td>
|
||||
<td>S4</td>
|
||||
<td>S5</td>
|
||||
{% for label in scale.get_labels %}
|
||||
<td>{{ label }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
@ -1910,9 +1910,12 @@ def order_create(request, pk):
|
|||
else:
|
||||
formset = cls_formset(initial=initial)
|
||||
|
||||
scale.label_fmt = "S-{rev_i}"
|
||||
|
||||
return render(request, 'kfet/order_create.html', {
|
||||
'supplier': supplier,
|
||||
'formset': formset,
|
||||
'scale': scale,
|
||||
})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue