aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2017-01-19 18:14:31 +0200
committerFilipp Lepalaan <filipp@mac.com>2017-01-19 18:14:31 +0200
commit9fcb963e76d06ca4f659bc052bb46c3d50f155ce (patch)
treee8a3a1a533cbfe13ce34caa1d710e37869d7f080
parent28f4a5677b8f485224ef7df675228ccf657dcb75 (diff)
downloadServo-9fcb963e76d06ca4f659bc052bb46c3d50f155ce.tar.gz
Servo-9fcb963e76d06ca4f659bc052bb46c3d50f155ce.tar.bz2
Servo-9fcb963e76d06ca4f659bc052bb46c3d50f155ce.zip
Added checkin_enable setting
-rw-r--r--servo/forms/admin.py22
-rw-r--r--servo/models/common.py5
-rw-r--r--servo/templates/admin/settings.html3
3 files changed, 22 insertions, 8 deletions
diff --git a/servo/forms/admin.py b/servo/forms/admin.py
index f1e610d..ec4ee56 100644
--- a/servo/forms/admin.py
+++ b/servo/forms/admin.py
@@ -136,17 +136,16 @@ class QueueForm(BaseModelForm):
gsx_soldto = forms.ChoiceField(required=False, choices=())
users = forms.ModelMultipleChoiceField(queryset=User.active.all(),
- widget=forms.CheckboxSelectMultiple,
- required=False
- )
+ widget=forms.CheckboxSelectMultiple,
+ required=False)
class Meta:
model = Queue
exclude = ('statuses',)
widgets = {
- 'description' : forms.Textarea(attrs={'rows': 4}),
- 'keywords' : forms.Textarea(attrs={'rows': 4}),
- 'locations' : forms.CheckboxSelectMultiple,
+ 'description': forms.Textarea(attrs={'rows': 4}),
+ 'keywords': forms.Textarea(attrs={'rows': 4}),
+ 'locations': forms.CheckboxSelectMultiple,
}
def __init__(self, *args, **kwargs):
@@ -172,7 +171,7 @@ class QueueForm(BaseModelForm):
return
ftype = file_type(tpl.file.read())
-
+
if ftype != 'text/html':
raise forms.ValidationError(_('Print tempates must be in HTML format'))
@@ -292,6 +291,13 @@ class SettingsForm(BaseForm):
)
# start checkin fields
+ checkin_enable = forms.BooleanField(
+ initial=True,
+ required=False,
+ label=_("Enable check-in interface"),
+ help_text=_("Uncheck to disable the check-in interface")
+ )
+
checkin_user = forms.ModelChoiceField(
required=False,
label=_('User Account'),
@@ -339,11 +345,13 @@ class SettingsForm(BaseForm):
initial=True,
required=False,
label=_('Require device password'),
+ help_text=_('Check to make the "device password" field mandatory'),
)
checkin_require_condition = forms.BooleanField(
initial=True,
required=False,
label=_('Require device condition'),
+ help_text=_('Check to make the "device condition" field mandatory'),
)
# end checkin fields
diff --git a/servo/models/common.py b/servo/models/common.py
index 1f9af7c..b2b6c51 100644
--- a/servo/models/common.py
+++ b/servo/models/common.py
@@ -497,6 +497,7 @@ class Location(models.Model):
@classmethod
def get_checkin_list(cls):
+ """List service locations that are marked for check-in."""
results = []
for l in cls.objects.filter(checkin=True):
results.append({'pk': l.pk, 'name': l.title})
@@ -651,6 +652,10 @@ class Configuration(models.Model):
return config.get(key) if key else config
+ @classmethod
+ def checkin_enabled(cls):
+ return cls.conf('checkin_enable')
+
def save(self, *args, **kwargs):
config = super(Configuration, self).save(*args, **kwargs)
# Using cache instead of session since it's shared among
diff --git a/servo/templates/admin/settings.html b/servo/templates/admin/settings.html
index 85f7b61..bec147b 100644
--- a/servo/templates/admin/settings.html
+++ b/servo/templates/admin/settings.html
@@ -13,7 +13,7 @@
<li><a href="#tab7" data-toggle="tab">{% trans "GSX" %}</a></li>
<li><a href="#tab3" data-toggle="tab">{% trans "Outgoing Mail" %}</a></li>
<li><a href="#tab4" data-toggle="tab">{% trans "Incoming Mail" %}</a></li>
- <li><a href="#tab5" data-toggle="tab">{% trans "Text Messages" %}</a></li>
+ <li><a href="#tab5" data-toggle="tab">{% trans "SMS" %}</a></li>
<li><a href="#tab6" data-toggle="tab">{% trans "Check-in" %}</a></li>
</ul>
<div class="tab-content">
@@ -92,6 +92,7 @@
{% endif %}
</div>
<div class="tab-pane" id="tab6">
+ {% include "form_field_snippet.html" with field=form.checkin_enable %}
{% include "form_field_snippet.html" with field=form.checkin_user %}
{% include "form_field_snippet.html" with field=form.checkin_group %}
{% include "form_field_snippet.html" with field=form.checkin_queue %}