In this tutorial, we deep dive into managing URLs professionally in Django. You’ll learn how to replace ugly ID-based URLs with readable, SEO-friendly Slugs using the get_absolute_url() method and SlugField. We also cover the advanced logic needed to handle duplicate slugs and migrate existing database records.
What you will learn:
✅ Why get_absolute_url() is best practice / لماذا تعتبردالة الحصول على العنوان المطلق من أفضل الممارسات
✅ Implementing SEO-friendly Slugs / تطبيق السلاقات الصديقة لمحركات البحث
✅ Using the slugify function / استخدام دالة سلاقيفاي
✅ Handling duplicate slugs with custom logic / التعامل مع السلاقات المكررة برمجياً
✅ Migrating existing data to include slugs / إضافة السلاقات للبيانات الموجودة مسبقاً
✅ Using reverse() for dynamic routing / استخدام دالة الريفرس للتوجيه الديناميكي
Liked the video? Don't forget to 👍Like, ↩️Share, and 🔔Subscribe! هل أعجبك الفيديو؟ لا تنسى الإعجاب، المشاركة، والاشتراك في القناة! @Intuidemy
GitHub (Source Code): https://github.com/rubada/Django-Tuto...
📺 Full Django Playlist: • 02. Build a Complete Blog with Django | إن...
📍 Video Timeline:
00:00 - Channel Intro / مقدمة القناة
00:14 - Intro: The problem with ID-based URLs / مقدمة: مشكلة الروابط التي تعتمد على الرقم التعريفي
01:45 - Benefits of get_absolute_url() / فوائد استخدام دالة الحصول على العنوان المطلق
03:10 - Using reverse() and keyword arguments (kwargs) / استخدام الريفرس والوسائط المسماة
05:35 - Importing necessary functions (reverse, slugify) / استيراد الدوال اللازمة
06:05 - Implementing get_absolute_url with Primary Keys / تطبيق الدالة باستخدام المفاتيح الأساسية
10:00 - What is a Slug? (URL-friendly text) / ما هو السلاق؟ (نص صديق للروابط)
12:10 - Defining SlugField in the Model / تعريف حقل السلاق في الموديل
15:10 - Overriding the save() method for Auto-Generation / تعديل دالة الحفظ لإنشاء السلاق تلقائياً
16:30 - Logic for unique slugs (Handling duplicates) / منطق السلاقات الفريدة (منع التكرار)
19:15 - Updating urls.py to support Slugs / تحديث ملف الروابط لدعم السلاقات
20:45 - The Challenge: Adding Slugs to existing data / التحدي: إضافة السلاقات لبيانات موجودة مسبقاً
22:30 - Custom Data Migration steps (Step-by-Step) / خطوات ترحيل البيانات المخصصة (خطوة بخطوة)
24:45 - Running makemigrations and migrate safely / تشغيل عمليات الهجرة وقاعدة البيانات بأمان
27:40 - Final Testing and URL verification / التجربة النهائية والتحقق من الروابط
28:21 - Conclusion and what's next / الخاتمة والدرس القادم
#WebDevelopment #get_absolute_url #DjangoSlugs #CodingTutorial #Intuidemy #برمجة #ديجانجو #تطوير_مواقع #بايثون