Commit 0be37a6d authored by Gabriel Detraz's avatar Gabriel Detraz
Browse files

Le droit imprimeur permet de lancer les impressions en A3

parent 616da1ef
......@@ -134,6 +134,12 @@ class PrintForm(forms.Form):
del champ # Gruiiik
copies.widget.attrs["onKeyUp"] = javascript_function
def __init__(self,*args,**kwargs):
full_choice_paper = kwargs.pop('full_choice_paper')
if full_choice_paper:
self.fields['format'].choices = [('A4', u'A4'), ('A3', u'A3')]
def clean(self):
"""Certains valeurs des paramètres sont incompatibles."""
out = forms.Form.clean(self)
......@@ -14,6 +14,7 @@ from django.shortcuts import render_to_response,render
from django.views.generic.detail import DetailView
from django.utils.translation import ugettext_lazy as _
from django.forms import formset_factory
from functools import partial, wraps
# Paginateur , afin d'éviter de trop longues pages
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
......@@ -163,7 +164,7 @@ def view(request):
if uploadform.is_valid():
initial_data = [{'filenom': form.cleaned_data["fichier"].name,
'pageno' : form.cleaned_data["pageno"],} for form in uploadform if form.cleaned_data.has_key("fichier")]
printform = formset_factory(PrintForm, extra=0)
printform = formset_factory(wraps(PrintForm)(partial(PrintForm, full_choice_paper=is_imprimeur(request))), extra=0)
printform = printform(initial=initial_data)
return render(request, "impressions/print.html",
{'printform': printform,
Supports Markdown
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