aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--servo/forms/notes.py5
-rw-r--r--servo/migrations/0030_note_type.py19
-rw-r--r--servo/models/note.py27
-rwxr-xr-xservo/templates/notes/form.html1
-rw-r--r--servo/views/note.py4
5 files changed, 49 insertions, 7 deletions
diff --git a/servo/forms/notes.py b/servo/forms/notes.py
index f569719..de60a56 100644
--- a/servo/forms/notes.py
+++ b/servo/forms/notes.py
@@ -16,11 +16,12 @@ class NoteForm(BaseModelForm):
exclude = []
widgets = {
'recipient' : TextInput,
- 'labels' : forms.CheckboxSelectMultiple,
+ 'subject' : TextInput,
'order' : forms.HiddenInput,
'parent' : forms.HiddenInput,
'customer' : forms.HiddenInput,
- 'subject' : TextInput
+ 'type' : forms.HiddenInput,
+ 'labels' : forms.CheckboxSelectMultiple,
}
def __init__(self, *args, **kwargs):
diff --git a/servo/migrations/0030_note_type.py b/servo/migrations/0030_note_type.py
new file mode 100644
index 0000000..8c2ee5e
--- /dev/null
+++ b/servo/migrations/0030_note_type.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('servo', '0029_auto_20150921_1111'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='note',
+ name='type',
+ field=models.IntegerField(default=0, verbose_name='Type', choices=[(0, 'Note'), (1, 'Problem'), (2, 'Escalation')]),
+ ),
+ ]
diff --git a/servo/models/note.py b/servo/models/note.py
index 0981530..da9e08a 100644
--- a/servo/models/note.py
+++ b/servo/models/note.py
@@ -58,6 +58,11 @@ def validate_phone_number(number):
class Note(MPTTModel):
+
+ T_NOTE = 0
+ T_PROBLEM = 1
+ T_ESCALATION = 2
+
subject = models.CharField(
blank=True,
max_length=255,
@@ -102,16 +107,32 @@ class Note(MPTTModel):
sent_at = models.DateTimeField(null=True, editable=False)
order = models.ForeignKey(Order, null=True, blank=True)
- is_reported = models.BooleanField(default=False, verbose_name=_("report"))
+ is_reported = models.BooleanField(
+ default=False,
+ verbose_name=_("Report")
+ )
is_read = models.BooleanField(
default=True,
editable=False,
- verbose_name=_("read")
+ verbose_name=_("Read")
)
is_flagged = models.BooleanField(
default=False,
editable=False,
- verbose_name=_("flagged")
+ verbose_name=_("Flagged")
+ )
+
+ TYPES = (
+ (T_NOTE, _('Note')),
+ (T_PROBLEM, _('Problem')),
+ (T_ESCALATION, _('Escalation')),
+ )
+
+ type = models.IntegerField(
+ blank=True,
+ default=T_NOTE,
+ choices=TYPES,
+ verbose_name=_('Type')
)
objects = TreeManager()
diff --git a/servo/templates/notes/form.html b/servo/templates/notes/form.html
index 372da30..c4eda72 100755
--- a/servo/templates/notes/form.html
+++ b/servo/templates/notes/form.html
@@ -51,6 +51,7 @@
{% include "form_field_snippet.html" with field=form.sender %}
{% include "form_field_snippet.html" with field=form.body %}
{% include "form_field_snippet.html" with field=form.is_reported %}
+ {{ form.type }}
</div>
<div class="tab-pane" id="tab2">
{% for f in formset %}
diff --git a/servo/views/note.py b/servo/views/note.py
index 7080386..0d7ae06 100644
--- a/servo/views/note.py
+++ b/servo/views/note.py
@@ -216,7 +216,7 @@ def edit(request, pk=None, order_id=None, parent=None, recipient=None, customer=
f.content_object = note
try:
f.save()
- except ValueError, e:
+ except ValueError as e:
messages.error(request, e)
return redirect(note)
@@ -226,7 +226,7 @@ def edit(request, pk=None, order_id=None, parent=None, recipient=None, customer=
try:
msg = note.send_and_save(request.user)
messages.success(request, msg)
- except ValueError, e:
+ except ValueError as e:
messages.error(request, e)
return redirect(note)