Django Model Relationships & Admin Integration

Day 95 – Django Model Relationships, Admin Integration & Media Handling Today I worked on building dynamic Course and Teacher management in Django by connecting frontend and backend with database-driven content. 🔹 Created a new Course Details page with navigation integration using templates, views, and URL routing. 🔹 Built a Details model with: • Course_name (CharField) • Course_dtls (TextField) Learned the importance of: ✔ null=True ✔ blank=True ✔ max_length ✔ Difference between CharField and TextField 🔹 Performed database migration using: makemigrations migrate 🔹 Registered models in Django Admin for easy backend management. 🔹 Fetched database content dynamically to the frontend using: Details.objects.all() and displayed it with Django template for-loops. 🔹 Created a second model: Teacher Fields included: • Teach_name • Course_name (ForeignKey with Details) • Teach_img (ImageField) This helped me understand: ✔ ForeignKey relationships ✔ on_delete=models.CASCADE ✔ Connecting two models in Django 🔹 Installed Pillow for image handling and configured: MEDIA_ROOT MEDIA_URL Also updated project urls.py for serving media files properly. 🔹 Successfully fetched teacher images from backend to frontend using: {{ i.Teach_img.url }} Today’s learning gave me a strong understanding of Django model relationships, admin panel usage, migrations, and media file management. Step by step, backend development is becoming more practical and exciting! 💻 #Django #Python #WebDevelopment #BackendDevelopment #FullStackDevelopment #DjangoDeveloper #SoftwareDevelopment #PythonDeveloper #DatabaseManagement

To view or add a comment, sign in

Explore content categories