aboutsummaryrefslogtreecommitdiffstats
path: root/servo/views/note.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-12-11 11:44:47 +0200
committerFilipp Lepalaan <filipp@mac.com>2015-12-11 11:44:47 +0200
commit9b0079214a8f011dc1e4919ccd9fc7504a8b62e1 (patch)
tree751519b543cd766505f23759ab27b539ad3c8146 /servo/views/note.py
parentc19241dc3812c92b150376c3c8108c3359aaf488 (diff)
downloadServo-9b0079214a8f011dc1e4919ccd9fc7504a8b62e1.tar.gz
Servo-9b0079214a8f011dc1e4919ccd9fc7504a8b62e1.tar.bz2
Servo-9b0079214a8f011dc1e4919ccd9fc7504a8b62e1.zip
Cleanup
Diffstat (limited to 'servo/views/note.py')
-rw-r--r--servo/views/note.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/servo/views/note.py b/servo/views/note.py
index 5cd47c8..803f1a2 100644
--- a/servo/views/note.py
+++ b/servo/views/note.py
@@ -19,19 +19,17 @@ from reportlab.graphics.shapes import Drawing
from reportlab.graphics.barcode import createBarcodeDrawing
from servo.lib.utils import paginate
-from servo.models import Order, Template, Tag, Customer, Note, Attachment, Escalation
+from servo.models import (Order, Template, Tag, Customer, Note,
+ Attachment, Escalation,)
from servo.forms import NoteForm, NoteSearchForm, EscalationForm
class BarcodeDrawing(Drawing):
def __init__(self, text_value, *args, **kwargs):
- barcode = createBarcodeDrawing(
- "Code128",
- value=text_value.encode("utf-8"),
- barHeight=10*mm,
- width=80*mm
- )
-
+ barcode = createBarcodeDrawing("Code128",
+ value=text_value.encode("utf-8"),
+ barHeight=10*mm,
+ width=80*mm)
Drawing.__init__(self, barcode.width, barcode.height, *args, **kwargs)
self.add(barcode, name="barcode")
@@ -96,7 +94,7 @@ def copy(request, pk):
new_note.labels = note.labels.all()
- for a in note.attachments.all():
+ for a in note.attachments.all(): # also copy the attachments
a.pk = None
a.content_object = new_note
a.save()
@@ -106,9 +104,11 @@ def copy(request, pk):
@permission_required('servo.change_note')
-def edit(request, pk=None, order_id=None, parent=None, recipient=None, customer=None):
+def edit(request, pk=None, order_id=None, parent=None, recipient=None,
+ customer=None):
"""
Edits a note
+ @FIXME: Should split this up into smaller pieces
"""
to = []
order = None
@@ -187,7 +187,8 @@ def edit(request, pk=None, order_id=None, parent=None, recipient=None, customer=
if note.escalation:
contexts = json.loads(note.escalation.contexts)
- escalation_form = EscalationForm(prefix='escalation', instance=note.escalation)
+ escalation_form = EscalationForm(prefix='escalation',
+ instance=note.escalation)
if request.method == "POST":
escalation_form = EscalationForm(request.POST,