From 467f9fef717cbdc217aae63fef6481150e8e34a7 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 24 May 2021 17:03:06 +0300 Subject: Checkin fixes --- servo/forms/base.py | 2 +- servo/forms/checkin.py | 11 +++++++---- servo/templates/checkin/newindex.html | 2 ++ servo/templates/default.html | 4 ++++ servo/views/checkin.py | 18 +++++++++--------- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/servo/forms/base.py b/servo/forms/base.py index b59215b..9467de5 100644 --- a/servo/forms/base.py +++ b/servo/forms/base.py @@ -72,7 +72,7 @@ class BaseModelForm(forms.ModelForm): class SearchFieldInput(forms.TextInput): - def render(self, name, value, attrs=None): + def render(self, name, value, attrs=None, **kwargs): field = super(SearchFieldInput, self).render(name, value, attrs) final_attrs = self.build_attrs(attrs) diff --git a/servo/forms/checkin.py b/servo/forms/checkin.py index c8429a9..6a6cf9d 100644 --- a/servo/forms/checkin.py +++ b/servo/forms/checkin.py @@ -40,6 +40,7 @@ class ConfirmationForm(forms.Form): class DeviceForm(forms.ModelForm): + """The form for editing devices in the /checkin view""" required_css_class = 'required' @@ -69,10 +70,12 @@ class DeviceForm(forms.ModelForm): help_text=_("Please describe the condition of the device") ) - queue = forms.ModelChoiceField(label=_('Queue'), - required=False, - queryset=Queue.objects.all(), - help_text=_('Assign order to this queue')) + queue = forms.ModelChoiceField( + label=_('Queue'), + required=False, + queryset=Queue.objects.all(), + help_text=_('Assign order to this queue') + ) class Meta: model = Device diff --git a/servo/templates/checkin/newindex.html b/servo/templates/checkin/newindex.html index 96c8042..f1fc035 100644 --- a/servo/templates/checkin/newindex.html +++ b/servo/templates/checkin/newindex.html @@ -99,6 +99,7 @@ {% bootstrap_field device_form.condition %}
+ {% if questions %} {% bootstrap_field device_form.pop %} @@ -121,6 +122,7 @@ {% endfor %}
+ {% endif %} {% bootstrap_field customer_form.checkin_location %} {% bootstrap_field customer_form.checkout_location %} {% if request.user.is_authenticated %} diff --git a/servo/templates/default.html b/servo/templates/default.html index de363f4..15de430 100755 --- a/servo/templates/default.html +++ b/servo/templates/default.html @@ -72,7 +72,11 @@
  • {% trans "System Settings" %}
  • {% endif %}
  • + {% if show_checkin %}
  • {% trans "Go to check-in" %}
  • + {% else %} +
  • {% trans "Go to check-in" %}
  • + {% endif %}
  • {% trans "Log out" %}...
  • {% endwith %} diff --git a/servo/views/checkin.py b/servo/views/checkin.py index 0c83201..513625b 100644 --- a/servo/views/checkin.py +++ b/servo/views/checkin.py @@ -138,7 +138,7 @@ def init_session(request): if not request.session.get('company_name'): request.session['company_name'] = Configuration.conf('company_name') - if request.user.is_authenticated(): + if request.user.is_authenticated: # these are our fallback defaults user = request.user @@ -193,7 +193,7 @@ def thanks(request, order): def get_customer(request): """Return the selected customer data.""" - if not request.user.is_authenticated(): + if not request.user.is_authenticated: raise PermissionDenied if not request.GET.get('c'): @@ -267,13 +267,13 @@ def index(request): title = _('Service Order Check-In') dcat = request.GET.get('d', 'mac') dmap = { - 'mac': _('Mac'), - 'iphone': _('iPhone'), - 'ipad': _('iPad'), - 'ipod': _('iPod'), - 'acc': _('Apple Accessory'), - 'beats': _('Beats Products'), - 'other': _('Other Devices'), + 'mac' : _('Mac'), + 'iphone' : _('iPhone'), + 'ipad' : _('iPad'), + 'ipod' : _('iPod'), + 'acc' : _('Apple Accessory'), + 'beats' : _('Beats Products'), + 'other' : _('Other Devices'), } issue_form = forms.IssueForm() -- cgit v1.2.3