From e0560397650bfc7d86cfbd2d037db087b7f0b576 Mon Sep 17 00:00:00 2001 From: sina_sajjadi Date: Mon, 19 Oct 2026 16:49:05 +0330 Subject: [PATCH] feat: add management command to seed quick access links for profiles --- .../commands/seed_quick_access_links.py | 83 ++++++++++++++++++- 1 file changed, 80 insertions(+), 3 deletions(-) diff --git a/apps/profiles/management/commands/seed_quick_access_links.py b/apps/profiles/management/commands/seed_quick_access_links.py index 957bd1c..a0b1859 100644 --- a/apps/profiles/management/commands/seed_quick_access_links.py +++ b/apps/profiles/management/commands/seed_quick_access_links.py @@ -48,22 +48,98 @@ PRESETS = [ }, ] +PRESETS_ENGLISH = [ + { + "title": "Virtual Tour 360°", + "url": "https://centralmosque.kz/virtual-tour", + "description": "Interactive 360° panoramic walkthrough of the historical prayer halls, minaret, and courtyard.", + "icon": "landmark", + "color": "emerald", + "category": "Virtual Tour", + "is_live": False, + "is_external": True, + "order": 1, + }, + { + "title": "Live Prayer & Jumu'ah Broadcast", + "url": "https://centralmosque.kz/live", + "description": "Continuous high-definition live stream of daily prayers, Azan recitation, and Friday congregational Khutbah.", + "icon": "video", + "color": "rose", + "category": "Live Stream", + "is_live": True, + "is_external": True, + "order": 2, + }, + { + "title": "Digital Islamic Library", + "url": "https://centralmosque.kz/library", + "description": "Access to historical Islamic manuscripts, Quranic commentaries, and regional Kazakh Islamic heritage.", + "icon": "bookOpen", + "color": "blue", + "category": "Digital Library", + "is_live": False, + "is_external": True, + "order": 3, + }, + { + "title": "Friday Sermons & Audio Lectures", + "url": "https://centralmosque.kz/media/lectures", + "description": "Archive of weekly Friday sermons, educational video series, and religious audio podcasts in Kazakh and Russian.", + "icon": "film", + "color": "purple", + "category": "Multimedia", + "is_live": False, + "is_external": True, + "order": 4, + }, + { + "title": "Prayer Times & Hijri Calendar", + "url": "https://centralmosque.kz/prayer-times", + "description": "Official daily prayer times, monthly timetable, and regional religious events calendar.", + "icon": "calendar", + "color": "amber", + "category": "Services", + "is_live": False, + "is_external": True, + "order": 5, + }, + { + "title": "Charity & Sadaqah Fund", + "url": "https://centralmosque.kz/charity", + "description": "Secure online portal for Zakat, voluntary Sadaqah, and supporting community welfare initiatives.", + "icon": "heartHandshake", + "color": "teal", + "category": "Charity", + "is_live": False, + "is_external": True, + "order": 6, + }, +] + class Command(BaseCommand): - help = "Seed canonical quick access links for primary institution (e.g. Astan Quds / ID 1)" + help = "Seed canonical quick access links for institutions (e.g. Astan Quds / ID 1 or Central City Mosque / ID 1815)" def add_arguments(self, parser): parser.add_argument('--institution-id', type=int, default=1, help='Institution ID to attach links to') + parser.add_argument('--preset', type=str, choices=['fa', 'en'], default=None, help='Preset language/template (fa or en)') def handle(self, *args, **options): inst_id = options.get('institution_id', 1) + preset_choice = options.get('preset') institution = Institution.objects.filter(id=inst_id).first() or Institution.objects.first() if not institution: self.stdout.write(self.style.WARNING("No institution found to seed quick access links.")) return + if preset_choice == 'en' or institution.id == 1815 or 'central' in institution.name.lower(): + presets = PRESETS_ENGLISH + else: + presets = PRESETS + created_count = 0 - for item in PRESETS: + for item in presets: link, created = QuickAccessLink.objects.update_or_create( institution=institution, title=item['title'], @@ -84,6 +160,7 @@ class Command(BaseCommand): self.stdout.write( self.style.SUCCESS( - f"Successfully seeded canonical quick access links for '{institution.name}' (ID: {institution.id})." + f"Successfully seeded canonical quick access links ({len(presets)} links) for '{institution.name}' (ID: {institution.id})." ) ) +