Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nounous-archives
intranet
Commits
0be37a6d
Commit
0be37a6d
authored
Oct 13, 2017
by
Gabriel Detraz
Browse files
Le droit imprimeur permet de lancer les impressions en A3
parent
616da1ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
impressions/forms.py
View file @
0be37a6d
...
...
@@ -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'
)
super
(
PrintForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
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
)
...
...
impressions/views.py
View file @
0be37a6d
...
...
@@ -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
,
...
...
Gabriel Detraz
@detraz
mentioned in commit
e084a59e
·
Oct 18, 2017
mentioned in commit
e084a59e
mentioned in commit e084a59eeb8bb0483e1b3108ec455fc2d6a88c83
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment