diff --git a/mayan/apps/appearance/static/appearance/css/base.css b/mayan/apps/appearance/static/appearance/css/base.css
index 9c9a7085dc..75bc2456fd 100644
--- a/mayan/apps/appearance/static/appearance/css/base.css
+++ b/mayan/apps/appearance/static/appearance/css/base.css
@@ -130,3 +130,7 @@ hr {
.a-caption {
color: white;
}
+
+.radio ul li {
+ list-style-type:none;
+}
diff --git a/mayan/apps/appearance/templates/appearance/generic_form_instance.html b/mayan/apps/appearance/templates/appearance/generic_form_instance.html
index 7a4f2092fe..72e631d7cf 100644
--- a/mayan/apps/appearance/templates/appearance/generic_form_instance.html
+++ b/mayan/apps/appearance/templates/appearance/generic_form_instance.html
@@ -59,6 +59,10 @@
{% else %}
{% render_field field class+="" %}
{% endif %}
+ {% elif field|widget_type == 'radioselect' %}
+
+ {% render_field field %}
+
{% else %}
{% render_field field class+="form-control" %}
{% endif %}
diff --git a/mayan/apps/documents/forms.py b/mayan/apps/documents/forms.py
index aa5e4b9001..aa2b34bba0 100644
--- a/mayan/apps/documents/forms.py
+++ b/mayan/apps/documents/forms.py
@@ -8,7 +8,7 @@ from common.forms import DetailForm
from .models import (
Document, DocumentType, DocumentPage, DocumentTypeFilename
)
-from .literals import DEFAULT_ZIP_FILENAME
+from .literals import DEFAULT_ZIP_FILENAME, PAGE_RANGE_CHOICES
from .widgets import DocumentPagesCarouselWidget, DocumentPageImageWidget
@@ -108,10 +108,6 @@ class DocumentTypeSelectForm(forms.Form):
)
-class PrintForm(forms.Form):
- page_range = forms.CharField(label=_('Page range'), required=False)
-
-
class DocumentTypeFilenameForm_create(forms.ModelForm):
"""
Model class form to create a new document type filename
@@ -146,3 +142,10 @@ class DocumentDownloadForm(forms.Form):
if len(self.document_versions) > 1:
self.fields['compressed'].initial = True
self.fields['compressed'].widget.attrs.update({'disabled': True})
+
+
+class PrintForm(forms.Form):
+ page_group = forms.ChoiceField(
+ widget=forms.RadioSelect, choices=PAGE_RANGE_CHOICES
+ )
+ page_range = forms.CharField(label=_('Page range'), required=False)
diff --git a/mayan/apps/documents/literals.py b/mayan/apps/documents/literals.py
index 4c740ea414..c4d8b4b812 100644
--- a/mayan/apps/documents/literals.py
+++ b/mayan/apps/documents/literals.py
@@ -1,5 +1,7 @@
from __future__ import unicode_literals
+from django.utils.translation import ugettext_lazy as _
+
CACHE_PATH = 'document_cache/'
CHECK_DELETE_PERIOD_INTERVAL = 60
CHECK_TRASH_PERIOD_INTERVAL = 60
@@ -10,3 +12,10 @@ DOCUMENT_IMAGE_TASK_TIMEOUT = 20
UPDATE_PAGE_COUNT_RETRY_DELAY = 10
UPLOAD_NEW_VERSION_RETRY_DELAY = 10
NEW_DOCUMENT_RETRY_DELAY = 10
+
+PAGE_RANGE_ALL = 'all'
+PAGE_RANGE_RANGE = 'range'
+PAGE_RANGE_CHOICES = (
+ (PAGE_RANGE_ALL, _('All pages')), (PAGE_RANGE_RANGE, _('Page range'))
+)
+
diff --git a/mayan/apps/documents/templates/documents/document_print.html b/mayan/apps/documents/templates/documents/document_print.html
index 0f957c9d2a..3ee1bea746 100644
--- a/mayan/apps/documents/templates/documents/document_print.html
+++ b/mayan/apps/documents/templates/documents/document_print.html
@@ -1,5 +1,7 @@
{% extends 'appearance/base.html' %}
+{% block title %}{{ title }}{% endblock title %}
+
{% block content_plain %}
{% for page in pages %}
diff --git a/mayan/apps/documents/views.py b/mayan/apps/documents/views.py
index 48920afe39..6e7bc49d7f 100644
--- a/mayan/apps/documents/views.py
+++ b/mayan/apps/documents/views.py
@@ -39,7 +39,7 @@ from .forms import (
DocumentPropertiesForm, DocumentTypeSelectForm,
DocumentTypeFilenameForm_create, PrintForm
)
-from .literals import DOCUMENT_IMAGE_TASK_TIMEOUT
+from .literals import DOCUMENT_IMAGE_TASK_TIMEOUT, PAGE_RANGE_RANGE
from .models import (
DeletedDocument, Document, DocumentType, DocumentPage,
DocumentTypeFilename, DocumentVersion, RecentDocument
@@ -1092,30 +1092,32 @@ def document_print(request, document_id):
if request.method == 'POST':
form = PrintForm(request.POST)
if form.is_valid():
- if form.cleaned_data['page_range']:
+ if form.cleaned_data['page_group'] == PAGE_RANGE_RANGE:
page_range = form.cleaned_data['page_range']
if page_range:
page_range = parse_range(page_range)
-
pages = document.pages.filter(page_number__in=page_range)
else:
pages = document.pages.all()
+ else:
+ pages = document.pages.all()
- return render_to_response('documents/document_print.html', {
- 'appearance_type': 'plain',
- 'object': document,
- 'page_range': page_range,
- 'pages': pages,
- }, context_instance=RequestContext(request))
+ return render_to_response('documents/document_print.html', {
+ 'appearance_type': 'plain',
+ 'object': document,
+ 'pages': pages,
+ 'title': _('Print: %s') % document,
+ }, context_instance=RequestContext(request))
else:
form = PrintForm()
return render_to_response('appearance/generic_form.html', {
'form': form,
'object': document,
- 'title': _('Print: %s') % document,
'next': next,
+ 'title': _('Print: %s') % document,
+ 'submit_label': _('Submit'),
}, context_instance=RequestContext(request))