diff options
author | Filipp Lepalaan <filipp@mac.com> | 2016-03-21 19:14:37 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2016-03-21 19:14:37 +0200 |
commit | 1b6e5ee722f76f594e3d95dfa8d77ac2b9f2173a (patch) | |
tree | 61dd9498cac2b20501bf96f54a95a89d714d4449 /servo/views | |
parent | f30d6d73513a5535cae4d97ee2cc85f01660750c (diff) | |
download | Servo-1b6e5ee722f76f594e3d95dfa8d77ac2b9f2173a.tar.gz Servo-1b6e5ee722f76f594e3d95dfa8d77ac2b9f2173a.tar.bz2 Servo-1b6e5ee722f76f594e3d95dfa8d77ac2b9f2173a.zip |
Adding GSX articles
Diffstat (limited to 'servo/views')
-rw-r--r-- | servo/views/note.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/servo/views/note.py b/servo/views/note.py index 803f1a2..416e845 100644 --- a/servo/views/note.py +++ b/servo/views/note.py @@ -19,8 +19,8 @@ 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, Article,) from servo.forms import NoteForm, NoteSearchForm, EscalationForm @@ -58,6 +58,9 @@ def prep_list_view(request, kind): data = {'title': _("Messages")} all_notes = Note.objects.all().order_by("-created_at") + if kind == "articles": + all_notes = Article.objects.all() + #all_notes = all_notes.filter(order=None).order_by("is_read", "-created_at") if kind == "inbox": all_notes = all_notes.filter(order=None).order_by("is_read", "-created_at") if kind == "sent": @@ -119,7 +122,7 @@ def edit(request, pk=None, order_id=None, parent=None, recipient=None, if recipient is not None: to.append(recipient) command = _('Send') - + if order_id is not None: order = get_object_or_404(Order, pk=order_id) @@ -315,15 +318,22 @@ def list_notes(request, kind="inbox"): def view_note(request, kind, pk): - note = get_object_or_404(Note, pk=pk) + if kind == 'articles': + note = get_object_or_404(Article, pk=pk) + else: + note = get_object_or_404(Note, pk=pk) + data = prep_list_view(request, kind) - data['title'] = note.subject + data['title'] = note.get_title() data['note'] = note if kind == 'escalations': return render(request, "notes/view_escalation.html", data) - else: - return render(request, "notes/view_note.html", data) + + if kind == 'articles': + return render(request, "notes/view_article.html", data) + + return render(request, "notes/view_note.html", data) def find(request): |