From e59593e4459c1d85a61ae8d557d7dcce70d81195 Mon Sep 17 00:00:00 2001 From: Tobias Bengfort Date: Wed, 24 Jul 2019 13:06:41 +0200 Subject: [PATCH 1/9] run isort --- users/migrations/0017_rm_read_perm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/users/migrations/0017_rm_read_perm.py b/users/migrations/0017_rm_read_perm.py index 06d80b0f..4ac3fb49 100644 --- a/users/migrations/0017_rm_read_perm.py +++ b/users/migrations/0017_rm_read_perm.py @@ -1,6 +1,7 @@ # Generated by Django 2.2.1 on 2019-05-14 14:14 -from django.db import migrations, models +from django.db import migrations +from django.db import models class Migration(migrations.Migration): From 8c38ac65269f47e1e6fa5ea6e38b31520e14f4a4 Mon Sep 17 00:00:00 2001 From: Tobias Bengfort Date: Wed, 24 Jul 2019 13:07:59 +0200 Subject: [PATCH 2/9] fix E741 ambiguous variable --- devices/management/commands/ldapimport.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devices/management/commands/ldapimport.py b/devices/management/commands/ldapimport.py index 55770bb3..e0a8bd07 100644 --- a/devices/management/commands/ldapimport.py +++ b/devices/management/commands/ldapimport.py @@ -61,12 +61,12 @@ def handle(self, *args, **options): print("You have to enable the USE_LDAP setting to use the ldap import.") return # ldap.set_option(ldap.OPT_DEBUG_LEVEL, 4095) - l = PagedResultsSearchObject(settings.AUTH_LDAP_SERVER_URI) - l.simple_bind_s(settings.AUTH_LDAP_BIND_DN, settings.AUTH_LDAP_BIND_PASSWORD) + search = PagedResultsSearchObject(settings.AUTH_LDAP_SERVER_URI) + search.simple_bind_s(settings.AUTH_LDAP_BIND_DN, settings.AUTH_LDAP_BIND_PASSWORD) created_users = 0 updated_users = 0 skipped_users = 0 - page_count, users = l.paged_search_ext_s(*settings.LDAP_USER_SEARCH) + page_count, users = search.paged_search_ext_s(*settings.LDAP_USER_SEARCH) for dn, userdata in users: saveuser = False From 9ec69c7d207c7c7f4b6d82e6536edc6d2d6aaca6 Mon Sep 17 00:00:00 2001 From: Tobias Bengfort Date: Wed, 24 Jul 2019 13:08:25 +0200 Subject: [PATCH 3/9] fix E131 continuation line unaligned for hanging indent --- history/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/history/views.py b/history/views.py index 7c337d2f..54a27f3a 100644 --- a/history/views.py +++ b/history/views.py @@ -84,9 +84,13 @@ class HistoryDetail(PermissionRequiredMixin, UpdateView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) + model = apps.get_model( + context["this_version"].content_type.app_label, + context["this_version"].content_type.model, + ) context["current_version"] = get_object_or_404( - apps.get_model(context["this_version"].content_type.app_label, context["this_version"].content_type.model), - id=context["this_version"].object_id) + model, id=context["this_version"].object_id + ) context["this_version"] = cleanup_fielddict(context["this_version"]) From ff62b3a17cb27ee2f510530c211aee5808faf2ed Mon Sep 17 00:00:00 2001 From: Tobias Bengfort Date: Wed, 24 Jul 2019 13:41:46 +0200 Subject: [PATCH 4/9] fix some other issues --- devicegroups/views.py | 9 +++-- devices/ajax.py | 77 +++++++++++++++++++++++++++---------------- devices/forms.py | 20 +++++------ devices/views.py | 35 ++++++++++++-------- history/views.py | 14 +++++--- mail/models.py | 6 ++-- main/views.py | 55 +++++++++++++++++-------------- network/views.py | 5 +-- users/views.py | 16 ++++++--- 9 files changed, 145 insertions(+), 92 deletions(-) diff --git a/devicegroups/views.py b/devicegroups/views.py index 3e46ce62..f908cd8e 100644 --- a/devicegroups/views.py +++ b/devicegroups/views.py @@ -66,9 +66,12 @@ def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super().get_context_data(**kwargs) context["breadcrumbs"] = [ - (reverse("devicegroup-list"), _("Devicegroups"))] - context["viewform"] = DepartmentViewForm(initial={"sorting": self.viewsorting, - "department": self.departmentfilter}) + (reverse("devicegroup-list"), _("Devicegroups")) + ] + context["viewform"] = DepartmentViewForm(initial={ + "sorting": self.viewsorting, + "department": self.departmentfilter, + }) # filtering if self.filterstring: diff --git a/devices/ajax.py b/devices/ajax.py index fc9d1f6d..9fe5df47 100644 --- a/devices/ajax.py +++ b/devices/ajax.py @@ -75,9 +75,11 @@ def get(self, request): else: return HttpResponse("") if len(objects) > 0: - retobjects = ["
  • {1}
  • ".format( - reverse(urlname, kwargs={"pk": obj[0]}), obj[1]) - for obj in objects.values_list("pk", "name")] + retobjects = [ + "
  • {1}
  • ".format( + reverse(urlname, kwargs={"pk": obj[0]}), obj[1] + ) for obj in objects.values_list("pk", "name") + ] return HttpResponse(json.dumps(retobjects), content_type='application/json') else: return HttpResponse("") @@ -216,13 +218,19 @@ def get(self, request): return HttpResponse("") user = get_object_or_404(Lageruser, pk=user) data = {} - data["devices"] = [[device["device__name"] if device["device__name"] else device["smalldevice"], - device["device__inventorynumber"], device["device__serialnumber"], - device["duedate"].strftime("%d.%m.%y") if device["duedate"] else "", device["pk"]] - for device in user.lending_set.filter(returndate=None).values("pk", "device__name", - "device__inventorynumber", - "device__serialnumber", - "smalldevice", "duedate")] + data["devices"] = [ + [ + device["device__name"] if device["device__name"] else device["smalldevice"], + device["device__inventorynumber"], + device["device__serialnumber"], + device["duedate"].strftime("%d.%m.%y") if device["duedate"] else "", + device["pk"], + ] + for device in user.lending_set.filter(returndate=None).values( + "pk", "device__name", "device__inventorynumber", + "device__serialnumber", "smalldevice", "duedate", + ) + ] return HttpResponse(json.dumps(data), content_type='application/json') @@ -230,16 +238,22 @@ def get(self, request): class PuppetDetails(View): def get(self, request, device): - params = urllib.parse.urlencode({'query': '["in", "certname",["extract", "certname",' - + '["select_facts",["and",["=", "name","' - + settings.PUPPETDB_SETTINGS['query_fact'] + '"],' - + '["=","value","' + str(device) + '"]]]]]'}) + query = ( + '["in", "certname", ["extract", "certname", ["select_facts", ' + '["and", ["=", "name", "{}"], ["=", "value", "{}"]]]]]' + ).format(settings.PUPPETDB_SETTINGS['query_fact'], str(device)) + params = urllib.parse.urlencode({'query': query}) + context = ssl.create_default_context(cafile=settings.PUPPETDB_SETTINGS['cacert']) - context.load_cert_chain(certfile=settings.PUPPETDB_SETTINGS['cert'], - keyfile=settings.PUPPETDB_SETTINGS['key']) - conn = http.client.HTTPSConnection(settings.PUPPETDB_SETTINGS['host'], - settings.PUPPETDB_SETTINGS['port'], - context=context) + context.load_cert_chain( + certfile=settings.PUPPETDB_SETTINGS['cert'], + keyfile=settings.PUPPETDB_SETTINGS['key'], + ) + conn = http.client.HTTPSConnection( + settings.PUPPETDB_SETTINGS['host'], + settings.PUPPETDB_SETTINGS['port'], + context=context, + ) conn.request("GET", settings.PUPPETDB_SETTINGS['req'] + params) res = conn.getresponse() if res.status != http.client.OK: @@ -257,16 +271,23 @@ def get(self, request, device): software_fact = settings.PUPPETDB_SETTINGS['software_fact'] query_fact = settings.PUPPETDB_SETTINGS['query_fact'] - params = urllib.parse.urlencode({'query': '["and", [ "=", "name", "' + software_fact + '"],' - + '["in", "certname",["extract", "certname",' - + '["select_facts",["and",["=", "name","' + query_fact + '"],' - + '["=","value","' + str(device) + '"]]]]]]'}) + query = ( + '["and", ["=", "name", "{}"], ["in", "certname", ' + '["extract", "certname", ["select_facts", ["and", ' + '["=", "name", "{}"], ["=", "value", "{}"]]]]]]' + ).format(software_fact, query_fact, str(device)) + params = urllib.parse.urlencode({'query': query}) + context = ssl.create_default_context(cafile=settings.PUPPETDB_SETTINGS['cacert']) - context.load_cert_chain(certfile=settings.PUPPETDB_SETTINGS['cert'], - keyfile=settings.PUPPETDB_SETTINGS['key']) - conn = http.client.HTTPSConnection(settings.PUPPETDB_SETTINGS['host'], - settings.PUPPETDB_SETTINGS['port'], - context=context) + context.load_cert_chain( + certfile=settings.PUPPETDB_SETTINGS['cert'], + keyfile=settings.PUPPETDB_SETTINGS['key'], + ) + conn = http.client.HTTPSConnection( + settings.PUPPETDB_SETTINGS['host'], + settings.PUPPETDB_SETTINGS['port'], + context=context, + ) conn.request("GET", settings.PUPPETDB_SETTINGS['req'] + params) res = conn.getresponse() if res.status != http.client.OK: diff --git a/devices/forms.py b/devices/forms.py index 46b28943..9c921134 100644 --- a/devices/forms.py +++ b/devices/forms.py @@ -90,16 +90,16 @@ def get_emailrecipientlist(special=None): objects = [] if special: - objects.append((_("Special"), - [(value, key) for key, value in special.items()] - )) - - objects.append((_("Groups"), - [("g" + str(group.id), group.name) for group in Group.objects.all().order_by("name")], - )) - objects.append((_("People"), - [("u" + str(user.id), user) for user in Lageruser.objects.all().order_by("last_name")], - )) + objects.append( + (_("Special"), [(value, key) for key, value in special.items()]) + ) + + objects.append( + (_("Groups"), [("g" + str(group.id), group.name) for group in Group.objects.all().order_by("name")]) + ) + objects.append( + (_("People"), [("u" + str(user.id), user) for user in Lageruser.objects.all().order_by("last_name")]) + ) return objects diff --git a/devices/views.py b/devices/views.py index 6a244b1d..6f10088c 100644 --- a/devices/views.py +++ b/devices/views.py @@ -190,9 +190,11 @@ def post(self, request): class DeviceDetail(PermissionRequiredMixin, DetailView): # get related data to chosen device queryset = Device.objects \ - .select_related("manufacturer", "devicetype", "currentlending", "currentlending__owner", "department", - "room", "room__building") \ - .prefetch_related("pictures", ) + .select_related( + "manufacturer", "devicetype", "currentlending", + "currentlending__owner", "department", "room", "room__building", + )\ + .prefetch_related("pictures") context_object_name = 'device' object = None permission_required = 'devices.view_device' @@ -226,15 +228,20 @@ def get_context_data(self, **kwargs): context['tagform'].fields["tags"].queryset = Devicetag.objects.exclude(devices=context["device"]) # lending history, eidt history, mail history - context["lending_list"] = Lending.objects.filter(device=context["device"])\ - .select_related("owner").order_by("-pk")[:10] - context["version_list"] = Version.objects.filter(object_id=context["device"].id, - content_type_id=ContentType.objects.get( - model='device').id) \ - .select_related("revision", "revision__user").order_by("-pk")[:10] + context["lending_list"] = Lending.objects\ + .filter(device=context["device"])\ + .select_related("owner")\ + .order_by("-pk")[:10] + context["version_list"] = Version.objects\ + .filter(object_id=context["device"].id, + content_type_id=ContentType.objects.get(model='device').id) \ + .select_related("revision", "revision__user")\ + .order_by("-pk")[:10] context['content_type'] = ContentType.objects.get(model='device').id - context["mail_list"] = MailHistory.objects.filter(device=context["device"])\ - .select_related("sent_by").order_by("-pk")[:10] + context["mail_list"] = MailHistory.objects\ + .filter(device=context["device"])\ + .select_related("sent_by")\ + .order_by("-pk")[:10] context["today"] = datetime.date.today() context["weekago"] = context["today"] - datetime.timedelta(days=7) @@ -1677,7 +1684,7 @@ def get_context_data(self, **kwargs): context["breadcrumbs"] = [("", _("Search"))] context["searchstring"] = self.get_searchstring() context["keys"] = sorted(list(self.STRING_FIELDS.keys()) - + list(self.DATE_FIELDS.keys())) + + list(self.DATE_FIELDS.keys())) return context @@ -1703,8 +1710,8 @@ def get_queryset(self): if self.groupfilter != "all": devices = devices.filter(group__id=self.groupfilter) return devices.values("id", "name", "inventorynumber", "devicetype__name", "room__name", - "room__building__name", - "group__name", "currentlending__owner__username", "currentlending__duedate") + "room__building__name", + "group__name", "currentlending__owner__username", "currentlending__duedate") def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) diff --git a/history/views.py b/history/views.py index 54a27f3a..cf50b26c 100644 --- a/history/views.py +++ b/history/views.py @@ -22,8 +22,10 @@ class Globalhistory(PermissionRequiredMixin, PaginationMixin, ListView): - queryset = Revision.objects.select_related("user").prefetch_related("version_set", "version_set__content_type" - ).filter().order_by("-date_created") + queryset = Revision.objects\ + .select_related("user")\ + .prefetch_related("version_set", "version_set__content_type")\ + .order_by("-date_created") context_object_name = "revision_list" template_name = 'history/globalhistory.html' permission_required = 'devices.change_device' @@ -139,8 +141,12 @@ def post(self, request, *args, **kwargs): TypeAttributeValue.objects.filter(device=version.object_id).delete() reversion.set_comment("Reverted to version from {0}".format(version.revision.date_created)) - messages.success(self.request, - _('Successfully reverted Device to revision {0}').format(version.revision.id)) + messages.success( + self.request, + _('Successfully reverted Device to revision {0}').format( + version.revision.id + ), + ) return HttpResponseRedirect(object.get_absolute_url()) diff --git a/mail/models.py b/mail/models.py index 69a79998..bc0e746c 100644 --- a/mail/models.py +++ b/mail/models.py @@ -58,8 +58,10 @@ def send(self, request, recipients=None, data=None): "inventorynumber": data["device"].inventorynumber, "manufacturer": data["device"].manufacturer, "name": str(data["device"]), - "room": (data["device"].room.name + " (" + data["device"].room.building.name + ")" if data[ - "device"].room is not None else ""), + "room": '' if data["device"].room is None else '{} ({})'.format( + data["device"].room.name, + data["device"].room.building.name, + ), "serialnumber": data["device"].serialnumber, "templending": data["device"].templending, "trashed": data["device"].trashed, diff --git a/main/views.py b/main/views.py index 0a7ef558..0a9aee05 100644 --- a/main/views.py +++ b/main/views.py @@ -33,15 +33,17 @@ def get_widget_data(user, widgetlist=[], only_user=False): context['device_all'] = devices.count() if context['device_all'] != 0: context['device_available'] = Device.active().filter(currentlending=None).count() - context["device_percent"] = 100 - int((float(context["device_available"] - ) / context["device_all"]) * 100) + context["device_percent"] = 100 - int( + float(context["device_available"]) / context["device_all"] * 100 + ) context["device_percentcolor"] = get_progresscolor(context["device_percent"]) context['ipaddress_all'] = IpAddress.objects.all().count() if context['ipaddress_all'] != 0: context['ipaddress_available'] = IpAddress.objects.filter(device=None).count() - context["ipaddress_percent"] = 100 - int((float(context["ipaddress_available"] - ) / context["ipaddress_all"]) * 100) + context["ipaddress_percent"] = 100 - int( + float(context["ipaddress_available"]) / context["ipaddress_all"] * 100 + ) context["ipaddress_percentcolor"] = get_progresscolor(context["ipaddress_percent"]) if "edithistory" in widgetlist: if only_user: @@ -62,8 +64,9 @@ def get_widget_data(user, widgetlist=[], only_user=False): context['newest_devices'] = devices.order_by("-pk")[:10] if "overdue" in widgetlist: if departments: - lendings = Lending.objects.select_related("device", "owner").filter(Q(device__department__in=departments) - | Q(owner__main_department__in=departments)) + lendings = Lending.objects.select_related("device", "owner").filter( + Q(device__department__in=departments) | Q(owner__main_department__in=departments) + ) else: lendings = Lending.objects.select_related("device", "owner") context["overdue"] = lendings.filter(duedate__lt=context["today"], returndate=None).order_by("duedate")[:10] @@ -73,8 +76,9 @@ def get_widget_data(user, widgetlist=[], only_user=False): context["sections"] = Section.objects.all() if "recentlendings" in widgetlist: if departments: - lendings = Lending.objects.select_related("device", "owner").filter(Q(device__department__in=departments) - | Q(owner__main_department__in=departments)) + lendings = Lending.objects.select_related("device", "owner").filter( + Q(device__department__in=departments) | Q(owner__main_department__in=departments) + ) else: lendings = Lending.objects.select_related("device", "owner") context["recentlendings"] = lendings.all().order_by("-pk")[:10] @@ -85,13 +89,16 @@ def get_widget_data(user, widgetlist=[], only_user=False): if "returnsoon" in widgetlist: soon = context["today"] + datetime.timedelta(days=10) if departments: - lendings = Lending.objects.select_related("device", "owner").filter(Q(device__department__in=departments) - | Q(owner__main_department__in=departments)) + lendings = Lending.objects.select_related("device", "owner").filter( + Q(device__department__in=departments) | Q(owner__main_department__in=departments) + ) else: lendings = Lending.objects.select_related("device", "owner") - context["returnsoon"] = lendings.filter(duedate__lte=soon, duedate__gt=context["today"], - returndate=None).order_by( - "duedate")[:10] + context["returnsoon"] = lendings.filter( + duedate__lte=soon, + duedate__gt=context["today"], + returndate=None + ).order_by("duedate")[:10] return context @@ -103,13 +110,10 @@ def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) if self.request.user.is_staff: - context["widgets_left"] = DashboardWidget.objects.filter(user=self.request.user, column="l" - ).order_by("index") - context["widgets_right"] = DashboardWidget.objects.filter(user=self.request.user, column="r" - ).order_by("index") + context["widgets_left"] = DashboardWidget.objects.filter(user=self.request.user, column="l").order_by("index") + context["widgets_right"] = DashboardWidget.objects.filter(user=self.request.user, column="r").order_by("index") userwidget_list = dict(WIDGETS) - widgetlist = [x[0] for x in DashboardWidget.objects.filter(user=self.request.user - ).values_list("widgetname")] + widgetlist = [x[0] for x in DashboardWidget.objects.filter(user=self.request.user).values_list("widgetname")] context.update(get_widget_data(self.request.user, widgetlist, only_user=True)) for w in context["widgets_left"]: if w.widgetname in userwidget_list: @@ -124,11 +128,14 @@ def get_context_data(self, **kwargs): w.delete() context["widgets_list"] = userwidget_list context["lendform"] = LendForm() - context["lendform"].fields["device"].choices = [[device[0], str(device[0]) + " - " + device[1]] for device - in Device.devices_for_departments(self.request.user.departments.all() - ).filter(trashed=None, currentlending=None, - archived=None).values_list('id', - 'name')] + context["lendform"].fields["device"].choices = [ + [device[0], str(device[0]) + " - " + device[1]] for device in ( + Device + .devices_for_departments(self.request.user.departments.all()) + .filter(trashed=None, currentlending=None, archived=None) + .values_list('id', 'name') + ) + ] context["lendform"].fields["device"].choices.insert(0, ["", "---------"]) context["userlist"] = Lageruser.objects.all().values( "pk", "username", "first_name", "last_name") diff --git a/network/views.py b/network/views.py index 966dbdf1..71eb1ade 100644 --- a/network/views.py +++ b/network/views.py @@ -62,8 +62,9 @@ def get_queryset(self): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["viewform"] = ViewForm(initial={ - 'category': self.viewfilter, - "department": self.departmentfilter}) + 'category': self.viewfilter, + "department": self.departmentfilter, + }) context["filterform"] = FilterForm(initial={ "filter": self.filterstring }) diff --git a/users/views.py b/users/views.py index d0a2c0a3..5d816163 100644 --- a/users/views.py +++ b/users/views.py @@ -89,9 +89,12 @@ def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) # shows list of edits made by user - context['edits'] = Version.objects.select_related("revision", "revision__user" - ).filter(content_type_id=ContentType.objects.get(model='device').id, - revision__user=context["profileuser"]).order_by("-pk") + context['edits'] = Version.objects\ + .select_related("revision", "revision__user")\ + .filter( + content_type_id=ContentType.objects.get(model='device').id, + revision__user=context["profileuser"])\ + .order_by("-pk") # shows list of user lendings context['lendings'] = Lending.objects.select_related("device", "device__room", "device__room__building", @@ -347,8 +350,11 @@ def get_context_data(self, **kwargs): def form_valid(self, form): self.department = get_object_or_404(Department, id=self.kwargs.get("pk", "")) if self.department not in form.cleaned_data["user"].departments.all(): - department_user = DepartmentUser(user=form.cleaned_data["user"], department=form.cleaned_data["department"], - role=form.cleaned_data["role"]) + department_user = DepartmentUser( + user=form.cleaned_data["user"], + department=form.cleaned_data["department"], + role=form.cleaned_data["role"], + ) department_user.save() if form.cleaned_data["user"].main_department is None: form.cleaned_data["user"].main_department = form.cleaned_data["department"] From 479a20856b8474c200a2062cd8c8ca0f7ad69b31 Mon Sep 17 00:00:00 2001 From: Tobias Bengfort Date: Wed, 24 Jul 2019 13:06:48 +0200 Subject: [PATCH 5/9] rm most lint exceptions --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index cc069b09..6e4bd8bc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,7 +9,7 @@ exclude= template, .venv, # TODO fix some of these -ignore= E124, E126, E127, E128, E131, E501, E722, E741, F403, F405, F999, W503 +ignore= E501, E722, F403, F405, W503 [isort] known_django=django From e730f1e17d394eddcce1984bc8e9e0f311280155 Mon Sep 17 00:00:00 2001 From: Tobias Bengfort Date: Wed, 24 Jul 2019 16:23:05 +0200 Subject: [PATCH 6/9] fix img rotate --- templates/devices/device_detail.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/devices/device_detail.html b/templates/devices/device_detail.html index 7047e6fe..01c49fd3 100644 --- a/templates/devices/device_detail.html +++ b/templates/devices/device_detail.html @@ -691,21 +691,21 @@

    {% trans "Installed software from puppetdb" %}

    }); $(document).on('click', '.rotate-picture-right', function(e) { - rotate_and_reload(e, "right"); + rotate_and_reload(this, "right"); }); $(document).on('click', '.rotate-picture-left', function(e) { - rotate_and_reload(e, "left"); + rotate_and_reload(this, "left"); }); - function rotate_and_reload(e, direction){ - var picture_id = e.target.id.replace("picture", "") + function rotate_and_reload(target, direction){ + var picture_id = target.id.replace("picture", "") var url = "{% url "device-api-picture-rotate" device.pk 0 "placeholder" %}".replace("pictures/0", "pictures/"+picture_id).replace("placeholder", direction); $.ajax({ url: url, type: 'PATCH', success: function(data) { var d = new Date(); - img = e.target.parentElement.parentElement.getElementsByTagName('img')[0]; + img = target.parentElement.parentElement.getElementsByTagName('img')[0]; if (data.new_source.length) { // image was converted to png img.src = img.src.replace(data.old_source, data.new_source); From f01c6d2c5ea819879480b2b42c654976a77971a7 Mon Sep 17 00:00:00 2001 From: Tobias Bengfort Date: Fri, 13 Sep 2019 10:49:01 +0200 Subject: [PATCH 7/9] mark string as translatable --- templates/devices/device_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/devices/device_detail.html b/templates/devices/device_detail.html index 7047e6fe..bf35ab22 100644 --- a/templates/devices/device_detail.html +++ b/templates/devices/device_detail.html @@ -563,7 +563,7 @@

    {% trans "10 last edits" %}

    {% if action.revision.user %} {{ action.revision.user }} {% else %} - Unknown + {% trans 'Unknown' %} {% endif %} {{ action.revision.comment|linebreaksbr|default:"" }} From 3550289aece34574d9ef626eed6d8645ac5afeea Mon Sep 17 00:00:00 2001 From: Tobias Bengfort Date: Fri, 13 Sep 2019 18:12:53 +0200 Subject: [PATCH 8/9] center text on error pages --- templates/403.html | 4 +--- templates/404.html | 4 +--- templates/500.html | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/templates/403.html b/templates/403.html index 3edbf198..d531ee25 100644 --- a/templates/403.html +++ b/templates/403.html @@ -4,7 +4,7 @@ {% block title %}{% trans "I can't let you do that." %}{% endblock %} {% block content %} -
    +

    @@ -13,9 +13,7 @@

    -

    {% trans "Error 403" %}

    -

    {% trans "I'm sorry, but I can't let you do that." %}

    {% endblock content %} \ No newline at end of file diff --git a/templates/404.html b/templates/404.html index 793a8d81..0ac108d8 100644 --- a/templates/404.html +++ b/templates/404.html @@ -4,11 +4,9 @@ {% block title %}{% trans "Nothing to see here" %}{% endblock %} {% block content %} -
    +

    -

    {% trans "Error 404" %}

    -

    {% trans "We couldn't find what you are looking for. Sorry for that" %}

    {% endblock content %} \ No newline at end of file diff --git a/templates/500.html b/templates/500.html index b564b6cb..84e4308f 100644 --- a/templates/500.html +++ b/templates/500.html @@ -4,9 +4,8 @@ {% block title %}{% trans "Something went wrong" %}{% endblock %} {% block content %} -
    +

    -

    {% trans "Error 500" %}

    {% trans "I regret to inform you, that our trained monkeys made a mistake when processing your request. Our trainers already have been informed of this incident and will try resolve the issue as soon as possible" %}

    From f54a65b38fc5f37c0e1739f889ecbbd4b32cc0be Mon Sep 17 00:00:00 2001 From: Tobias Bengfort Date: Fri, 13 Sep 2019 18:13:02 +0200 Subject: [PATCH 9/9] fix hal-eye --- static/css/main.css | 24 ++++++++++++++++++++++++ templates/403.html | 7 +------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/static/css/main.css b/static/css/main.css index 5d6ec6fa..63691d40 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -88,3 +88,27 @@ table tr th, table tr td { #puppetdetails_value { width: 70%; } + +.hal-eye { + display: inline-block; + width: 6em; + height: 6em; + line-height: 6em; + text-align: center; + vertical-align: middle; +} + +.hal-eye::after { + content: ""; + display: inline-block; + width: 0.3em; + height: 0.3em; + border-radius: 50%; + background-color: #fae966; + box-shadow: + 0 0 0.7em 0.1em #fae966, + 0 0 0 1em #e74c3c, + 0 0 0.7em 0.9em #b94a48, + 0 0 0 2.1em #212529, + 0 0 0 2.6em #95a5a6; +} diff --git a/templates/403.html b/templates/403.html index d531ee25..8916a408 100644 --- a/templates/403.html +++ b/templates/403.html @@ -6,12 +6,7 @@ {% block content %}

    - - - - - - +

    {% trans "Error 403" %}

    {% trans "I'm sorry, but I can't let you do that." %}