Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Change saleor_logo.svg in templates
michaldf2dde2ed643
diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.pyindex 05033aeded..5335afa01e 100644--- a/saleor/dashboard/order/views.py+++ b/saleor/dashboard/order/views.py@@ -2,6 +2,7 @@ from __future__ import unicode_literalsfrom django.contrib import messagesfrom django.contrib.auth.decorators import permission_required+from django.contrib.staticfiles.templatetags.staticfiles import staticfrom django.db import transactionfrom django.http import HttpResponsefrom django.shortcuts import get_object_or_404, redirect@@ -13,13 +14,14 @@ from django_prices.templatetags.prices_i18n import grossfrom payments import PaymentStatusfrom prices import Pricefrom weasyprint import HTML, CSS+from weasyprint.urls import URLFetchingErrorfrom ...core.utils import get_paginator_itemsfrom ...order import OrderStatusfrom ...order.models import Order, OrderedItem, OrderNote, DeliveryGroupfrom ...product.models import ProductVariantfrom ...userprofile.i18n import AddressForm-from ...settings import DASHBOARD_PAGINATE_BY, STATIC_ROOT+from ...settings import DASHBOARD_PAGINATE_BYfrom ..order.forms import OrderFilterFormfrom ..views import staff_member_requiredfrom .forms import (CancelGroupForm, CancelItemsForm, CancelOrderForm,@@ -378,15 +380,18 @@ def order_invoice(request, order_pk, group_pk):.select_related('user', 'shipping_address', 'billing_address'))order = get_object_or_404(qs, pk=order_pk)group = DeliveryGroup.objects.prefetch_related('items').get(pk=group_pk)- ctx = {'order': order,- 'group': group}- with open('static/images/saleor_logo.svg', 'rb') as f:- ctx['logo'] = f.read().replace(b'white', b'#333')+ ctx = {'order': order, 'group': group,+ 'logo_uri': request.build_absolute_uri(+ static('/images/saleor_logo_black.svg'))}rendered_template = get_template('dashboard/order/pdf/invoice.html').render(ctx)- stylesheet = CSS(STATIC_ROOT + '/assets/document.css')+ try:+ stylesheet = [CSS(+ url=request.build_absolute_uri(static('/assets/document.css')))]+ except URLFetchingError:+ stylesheet = Nonepdf_file = (HTML(string=rendered_template)- .write_pdf(stylesheets=[stylesheet]))+ .write_pdf(stylesheets=stylesheet))response = HttpResponse(pdf_file, content_type='application/pdf')name = "invoice-%s" % order.idresponse['Content-Disposition'] = 'filename=%s' % name@@ -399,15 +404,18 @@ def order_packing_slip(request, order_pk, group_pk):.select_related('user', 'shipping_address', 'billing_address'))order = get_object_or_404(qs, pk=order_pk)group = DeliveryGroup.objects.prefetch_related('items').get(pk=group_pk)- ctx = {'order': order,- 'group': group}- with open('static/images/saleor_logo.svg', 'rb') as f:- ctx['logo'] = f.read().replace(b'white', b'#333')+ ctx = {'order': order, 'group': group,+ 'logo_uri': request.build_absolute_uri(+ static('/images/saleor_logo_black.svg'))}rendered_template = get_template('dashboard/order/pdf/packing_slip.html').render(ctx)- stylesheet = CSS(STATIC_ROOT + '/assets/document.css')+ try:+ stylesheet = [CSS(+ url=request.build_absolute_uri(static('/assets/document.css')))]+ except URLFetchingError:+ stylesheet = Nonepdf_file = (HTML(string=rendered_template)- .write_pdf(stylesheets=[stylesheet]))+ .write_pdf(stylesheets=stylesheet))response = HttpResponse(pdf_file, content_type='application/pdf')name = "packing-slip-%s" % order.idresponse['Content-Disposition'] = 'filename=%s' % namediff --git a/saleor/dashboard/templatetags/utils.py b/saleor/dashboard/templatetags/utils.pyindex ef2498e956..69d5b23ad0 100644--- a/saleor/dashboard/templatetags/utils.py+++ b/saleor/dashboard/templatetags/utils.py@@ -30,12 +30,6 @@ def is_versatile_image_ppoi_click_widget(field):return isinstance(field.field.widget, VersatileImagePPOIClickWidget)-def svg_url(value):- prefix = u"data:image/svg+xml;charset=utf-8;base64,"- return prefix + b64encode(value).decode('utf-8')--@register.inclusion_tag('dashboard/product/product_variant/_image_select.html')def render_image_choice(field):choices = zip(field, field.field.queryset)diff --git a/saleor/static/images/saleor_logo_black.svg b/saleor/static/images/saleor_logo_black.svgnew file mode 100644index 0000000000..f9a95bdf26--- /dev/null+++ b/saleor/static/images/saleor_logo_black.svg@@ -0,0 +1,15 @@+<?xml version="1.0" encoding="utf-8"?>+<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"+ viewBox="0 0 282.3 60.9" height="38px" width="176px" enable-background="new 0 0 282.3 60.9" xml:space="preserve">+<path fill="#333" id="XMLID_124_" d="M267.7,37.7c6.1-2.8,10-9.2,10-16.7c0-5.7-2-10.1-6.2-14.1c-4.1-4-9.1-5.7-14.9-5.7h-27.2v15.9+ c-1-2.9-3.5-5.7-6.1-8.2C217,3,209.5,0,200.4,0s-16.5,3-22.9,8.9c-1.2,1.1-2.1,2.3-3.1,3.5V1.2h-43v44h-19v-44h-16v47.2L77.3,1.2+ H62.6L48.4,35.8c-1.8-4.7-6-8.2-13.2-10.8c-3.7-1.4-8.4-2.8-10.4-3.2c-1-0.3-2-0.6-3-1c-1.8-0.8-2.4-1.7-2.4-3.4+ c0-2.1,2.3-3.6,6.4-3.6c4.5,0,8,1.5,10.6,4.6l10.6-9C42.3,3.1,35,0,25.3,0c-5.8,0-10.8,1.5-14.9,4.6c-4.1,3.1-6.2,7.4-6.2,13+ c0,7.9,4.6,13.6,13.6,17c2.8,1,7,2.3,9.3,3c1.2,0.3,2.4,0.8,3.5,1.2c2.3,0.9,3.3,2,3.3,3.6c0,2.8-2.6,4.2-7.9,4.2+ c-6.2,0-11.6-3-14.7-7.3L0,48c2.3,3.5,5.5,6.4,9.7,8.9c4.3,2.4,9.7,3.6,16.3,3.6c5.3,0,9.7-1.1,13.3-2.7l-0.6,1.4h16.9l3.1-7h22.6+ l3,7h91.1v-9.9c0,0.9,1.4,1.8,2.3,2.7c6.3,5.9,13.8,8.9,22.9,8.9s16.4-3,22.7-8.9c2.7-2.5,5.1-5.3,6.1-8.2v15.5h16v-18h6.4h0.2+ l12,18h18.4L267.7,37.7z M62.8,39.2L69.9,21L77,39.2H62.8z M147.4,15.2h24.9c-1.6,3-2.7,5-3.4,8h-21.5V15.2z M147.4,45.2v-9h21.3+ c0.6,4,1.8,6,3.5,9H147.4z M211.9,41.8c-3.1,3.1-6.9,4.7-11.3,4.7c-4.5,0-8.3-1.5-11.4-4.6c-3.1-3.1-4.6-6.9-4.6-11.4+ c0-4.4,1.6-8.2,4.7-11.3c3.1-3.2,6.9-4.8,11.3-4.8s8.2,1.6,11.3,4.8c3.2,3.2,4.8,7,4.8,11.3C216.7,34.8,215.1,38.6,211.9,41.8z+ M254.8,28.2h-9.4v-13h10.7c3.1,0,5.6,2.4,5.6,6.2C261.7,25.8,259.1,28.2,254.8,28.2z"/>+</svg>diff --git a/templates/dashboard/order/pdf/invoice.html b/templates/dashboard/order/pdf/invoice.htmlindex c35b36f04a..02c218956c 100644--- a/templates/dashboard/order/pdf/invoice.html+++ b/templates/dashboard/order/pdf/invoice.html@@ -1,7 +1,6 @@{% load i18n static %}{% load prices_i18n %}{% load discount_amount_for from prices %}-{% load utils %}{% load static %}<html>@@ -11,7 +10,7 @@<body><header><div style="float:left">- <img src="{{ logo|svg_url|safe }}">+ <img src="{{ logo_uri }}"></div><divstyle="float:right">{{ order.created }}<br>{% trans "Order ID:" %} {{ order.id }}diff --git a/templates/dashboard/order/pdf/packing_slip.html b/templates/dashboard/order/pdf/packing_slip.htmlindex 06f3813253..3c8aacb0b9 100644--- a/templates/dashboard/order/pdf/packing_slip.html+++ b/templates/dashboard/order/pdf/packing_slip.html@@ -1,7 +1,6 @@{% load i18n static %}{% load prices_i18n %}{% load discount_amount_for from prices %}-{% load utils %}<html><head>@@ -10,8 +9,7 @@<body><header><div style="float:left">- <img src="{{ logo|svg_url|safe }}">- </div>+ <img src="{{ logo_uri }}"> </div><divstyle="float:right">{{ order.created }}<br>{% trans "Order ID:" %} {{ order.id }}</div>