Revision 43a5b181
Added by Frédéric Péters over 12 years ago
calebasse/dossiers/templates/dossiers/index.html | ||
---|---|---|
111 | 111 |
</tbody> |
112 | 112 |
</table> |
113 | 113 |
|
114 |
{% if request.GET %} |
|
115 |
<div class="pagination"> |
|
116 |
<span class="step-links"> |
|
117 |
{% if patient_records.has_previous %} |
|
118 |
<a href="?{{ query }}&page={{ patient_records.previous_page_number }}">««</a> |
|
119 |
{% endif %} |
|
120 |
|
|
121 |
<span class="current"> |
|
122 |
page {{ patient_records.number }} de {{ patient_records.paginator.num_pages }} |
|
123 |
</span> |
|
124 |
|
|
125 |
{% if patient_records.has_next %} |
|
126 |
<a href="?{{ query }}&page={{ patient_records.next_page_number }}">»»</a> |
|
127 |
{% endif %} |
|
128 |
</span> |
|
129 |
</div> |
|
130 |
{% endif %} |
|
131 |
|
|
132 |
|
|
114 | 133 |
{% if not request.GET %} |
115 | 134 |
<div class="big-msg-info"> |
116 | 135 |
Utilisez le formulaire de recherche sur la gauche de l'écran pour afficher |
calebasse/dossiers/templates/dossiers/quotations.html | ||
---|---|---|
73 | 73 |
</tbody> |
74 | 74 |
</table> |
75 | 75 |
|
76 |
{% if request.GET %} |
|
77 |
<div class="pagination"> |
|
78 |
<span class="step-links"> |
|
79 |
{% if patient_records.has_previous %} |
|
80 |
<a href="?{{ query }}&page={{ patient_records.previous_page_number }}">««</a> |
|
81 |
{% endif %} |
|
82 |
|
|
83 |
<span class="current"> |
|
84 |
page {{ patient_records.number }} de {{ patient_records.paginator.num_pages }} |
|
85 |
</span> |
|
86 |
|
|
87 |
{% if patient_records.has_next %} |
|
88 |
<a href="?{{ query }}&page={{ patient_records.next_page_number }}">»»</a> |
|
89 |
{% endif %} |
|
90 |
</span> |
|
91 |
</div> |
|
92 |
{% endif %} |
|
93 |
|
|
94 |
|
|
95 |
|
|
76 | 96 |
{% if not request.GET %} |
77 | 97 |
<div class="big-msg-info"> |
78 | 98 |
Utilisez le formulaire de recherche sur la gauche de l'écran pour afficher |
calebasse/dossiers/views.py | ||
---|---|---|
11 | 11 |
from django.views.generic import View |
12 | 12 |
from django.views.generic.edit import DeleteView, FormMixin |
13 | 13 |
from django.contrib import messages |
14 |
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger |
|
14 | 15 |
|
15 | 16 |
from calebasse import cbv |
16 | 17 |
from calebasse.doc_templates import make_doc_from_template |
... | ... | |
384 | 385 |
def get_context_data(self, **kwargs): |
385 | 386 |
ctx = super(PatientRecordsHomepageView, self).get_context_data(**kwargs) |
386 | 387 |
ctx['search_form'] = forms.SearchForm(data=self.request.GET or None) |
387 |
ctx['patient_records'] = []
|
|
388 |
patient_records = []
|
|
388 | 389 |
ctx['stats'] = {"dossiers": 0, |
389 | 390 |
"En_contact": 0, |
390 | 391 |
"Fin_daccueil": 0, |
... | ... | |
402 | 403 |
else: |
403 | 404 |
state = current_state.status.name |
404 | 405 |
state_class = current_state.status.type.lower() |
405 |
ctx['patient_records'].append(
|
|
406 |
patient_records.append(
|
|
406 | 407 |
{ |
407 | 408 |
'object': patient_record, |
408 | 409 |
'next_rdv': next_rdv, |
... | ... | |
417 | 418 |
ctx['stats'][state] = 0 |
418 | 419 |
ctx['stats'][state] += 1 |
419 | 420 |
|
421 |
page = self.request.GET.get('page') |
|
422 |
paginator = Paginator(patient_records, 3) |
|
423 |
try: |
|
424 |
patient_records = paginator.page(page) |
|
425 |
except PageNotAnInteger: |
|
426 |
patient_records = paginator.page(1) |
|
427 |
except EmptyPage: |
|
428 |
patient_records = paginator.page(paginator.num_pages) |
|
429 |
|
|
430 |
query = self.request.GET.copy() |
|
431 |
if 'page' in query: |
|
432 |
del query['page'] |
|
433 |
ctx['query'] = query.urlencode() |
|
434 |
|
|
435 |
ctx['patient_records'] = patient_records |
|
420 | 436 |
return ctx |
421 | 437 |
|
422 | 438 |
patientrecord_home = PatientRecordsHomepageView.as_view() |
... | ... | |
652 | 668 |
def get_context_data(self, **kwargs): |
653 | 669 |
ctx = super(PatientRecordsQuotationsView, self).get_context_data(**kwargs) |
654 | 670 |
ctx['search_form'] = forms.QuotationsForm(data=self.request.GET or None) |
655 |
ctx['patient_records'] = []
|
|
671 |
patient_records = []
|
|
656 | 672 |
if self.request.GET: |
657 | 673 |
for patient_record in ctx['object_list'].filter(): |
658 | 674 |
next_rdv = get_next_rdv(patient_record) |
... | ... | |
663 | 679 |
else: |
664 | 680 |
state = current_state.status.name |
665 | 681 |
state_class = current_state.status.type.lower() |
666 |
ctx['patient_records'].append(
|
|
682 |
patient_records.append(
|
|
667 | 683 |
{ |
668 | 684 |
'object': patient_record, |
669 | 685 |
'state': state, |
... | ... | |
673 | 689 |
state = state.replace(' ', '_') |
674 | 690 |
state = state.replace("'", '') |
675 | 691 |
|
692 |
page = self.request.GET.get('page') |
|
693 |
paginator = Paginator(patient_records, 50) |
|
694 |
try: |
|
695 |
patient_records = paginator.page(page) |
|
696 |
except PageNotAnInteger: |
|
697 |
patient_records = paginator.page(1) |
|
698 |
except EmptyPage: |
|
699 |
patient_records = paginator.page(paginator.num_pages) |
|
700 |
|
|
701 |
ctx['patient_records'] = patient_records |
|
702 |
|
|
703 |
query = self.request.GET.copy() |
|
704 |
if 'page' in query: |
|
705 |
del query['page'] |
|
706 |
ctx['query'] = query.urlencode() |
|
707 |
|
|
676 | 708 |
return ctx |
677 | 709 |
|
678 | 710 |
patientrecord_quotations = PatientRecordsQuotationsView.as_view() |
calebasse/static/css/style.css | ||
---|---|---|
1275 | 1275 |
text-align: right; |
1276 | 1276 |
} |
1277 | 1277 |
|
1278 |
div.pagination { |
|
1279 |
margin-top: 1em; |
|
1280 |
text-align: center; |
|
1281 |
} |
|
1282 |
|
|
1278 | 1283 |
/* makes the font 33% larger relative to the icon container */ |
1279 | 1284 |
.icon-large:before { |
1280 | 1285 |
vertical-align: top; |
Also available in: Unified diff
dossiers: add pagination to listings (#2094)