add a condition on method get_settings when containing company logo will be converting from base64
This commit is contained in:
parent
7db39ec925
commit
251e64dade
1 changed files with 10 additions and 0 deletions
|
@ -1,10 +1,20 @@
|
||||||
from openstack_dashboard.dashboards.yuyu.core import yuyu_client
|
from openstack_dashboard.dashboards.yuyu.core import yuyu_client
|
||||||
|
|
||||||
|
from django.utils.html import format_html
|
||||||
|
|
||||||
|
|
||||||
class SettingUseCase:
|
class SettingUseCase:
|
||||||
|
|
||||||
def get_settings(self, request):
|
def get_settings(self, request):
|
||||||
response = yuyu_client.get(request, "settings/").json()
|
response = yuyu_client.get(request, "settings/").json()
|
||||||
|
|
||||||
|
if response["company_logo"]:
|
||||||
|
# convert base64 img
|
||||||
|
response['company_logo'] = format_html(
|
||||||
|
'<img height="50" src="data:;base64,{}">',
|
||||||
|
response['company_logo']
|
||||||
|
)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def set_setting(self, request, key, value):
|
def set_setting(self, request, key, value):
|
||||||
|
|
Loading…
Add table
Reference in a new issue