feat: Add favicon and admin panel logo to PlatformProfile
This commit is contained in:
parent
cf8af51ff6
commit
582c5271c7
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -166,7 +166,7 @@ class ParcelAdmin(admin.ModelAdmin):
|
|||||||
class PlatformProfileAdmin(admin.ModelAdmin):
|
class PlatformProfileAdmin(admin.ModelAdmin):
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('General Info'), {
|
(_('General Info'), {
|
||||||
'fields': ('name', 'logo', 'slogan', 'address', 'phone_number', 'registration_number', 'vat_number')
|
'fields': ('name', 'logo', 'favicon', 'admin_panel_logo', 'slogan', 'address', 'phone_number', 'registration_number', 'vat_number')
|
||||||
}),
|
}),
|
||||||
(_('Financial Configuration'), {
|
(_('Financial Configuration'), {
|
||||||
'fields': ('platform_fee_percentage', 'enable_payment')
|
'fields': ('platform_fee_percentage', 'enable_payment')
|
||||||
|
|||||||
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 5.2.7 on 2026-01-31 13:05
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('core', '0024_platformprofile_auto_mark_paid'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='platformprofile',
|
||||||
|
name='admin_panel_logo',
|
||||||
|
field=models.ImageField(blank=True, help_text='Logo for the Admin Panel (top left).', null=True, upload_to='platform_logos/', verbose_name='Admin Panel Logo'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='platformprofile',
|
||||||
|
name='favicon',
|
||||||
|
field=models.ImageField(blank=True, help_text='Upload a favicon (e.g., .ico or .png)', null=True, upload_to='platform_logos/', verbose_name='Favicon'),
|
||||||
|
),
|
||||||
|
]
|
||||||
Binary file not shown.
Binary file not shown.
@ -134,6 +134,8 @@ class PricingRule(models.Model):
|
|||||||
class PlatformProfile(models.Model):
|
class PlatformProfile(models.Model):
|
||||||
name = models.CharField(_('Platform Name'), max_length=100)
|
name = models.CharField(_('Platform Name'), max_length=100)
|
||||||
logo = models.ImageField(_('Logo'), upload_to='platform_logos/', blank=True, null=True)
|
logo = models.ImageField(_('Logo'), upload_to='platform_logos/', blank=True, null=True)
|
||||||
|
favicon = models.ImageField(_('Favicon'), upload_to='platform_logos/', blank=True, null=True, help_text=_("Upload a favicon (e.g., .ico or .png)"))
|
||||||
|
admin_panel_logo = models.ImageField(_('Admin Panel Logo'), upload_to='platform_logos/', blank=True, null=True, help_text=_("Logo for the Admin Panel (top left)."))
|
||||||
slogan = models.CharField(_('Slogan'), max_length=255, blank=True)
|
slogan = models.CharField(_('Slogan'), max_length=255, blank=True)
|
||||||
address = models.TextField(_('Address'), blank=True)
|
address = models.TextField(_('Address'), blank=True)
|
||||||
phone_number = models.CharField(_('Phone Number'), max_length=50, blank=True)
|
phone_number = models.CharField(_('Phone Number'), max_length=50, blank=True)
|
||||||
|
|||||||
29
core/templates/admin/base.html
Normal file
29
core/templates/admin/base.html
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{% extends "admin/base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block extrahead %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% if platform_profile and platform_profile.favicon %}
|
||||||
|
<link rel="icon" href="{{ platform_profile.favicon.url }}">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if platform_profile and platform_profile.admin_panel_logo %}
|
||||||
|
<style>
|
||||||
|
/* Jazzmin Sidebar Logo Override */
|
||||||
|
.brand-link .brand-image {
|
||||||
|
content: url("{{ platform_profile.admin_panel_logo.url }}");
|
||||||
|
opacity: 1 !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
/* Adjust size to fit nicely */
|
||||||
|
max-height: 40px;
|
||||||
|
width: auto;
|
||||||
|
border-radius: 0; /* Sometimes logos are square, remove circular radius if default has it */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Optional: Hide the default elevation shadow if it looks weird with custom logo */
|
||||||
|
.brand-link .brand-image.elevation-3 {
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@ -8,6 +8,12 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>{% block title %}masarX | {% trans "Small Shipments, Smart Delivery" %}{% endblock %}</title>
|
<title>{% block title %}masarX | {% trans "Small Shipments, Smart Delivery" %}{% endblock %}</title>
|
||||||
|
|
||||||
|
{% if platform_profile and platform_profile.favicon %}
|
||||||
|
<link rel="icon" href="{{ platform_profile.favicon.url }}">
|
||||||
|
{% else %}
|
||||||
|
<link rel="icon" href="{% static 'img/logo.jpg' %}">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if project_description %}
|
{% if project_description %}
|
||||||
<meta name="description" content="{{ project_description }}">
|
<meta name="description" content="{{ project_description }}">
|
||||||
<meta property="og:description" content="{{ project_description }}">
|
<meta property="og:description" content="{{ project_description }}">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user