Learn Python Coding
40.1K subscribers
694 photos
34 videos
24 files
490 links
Learn Python through simple, practical examples and real coding ideas. Clear explanations, useful snippets, and hands-on learning for anyone starting or improving their programming skills.

Admin: @HusseinSheikho || @Hussein_Sheikho
Download Telegram
Django Features and Libraries - course

Exploring Django Features and Libraries
The "Django Features and Libraries" course is designed to help learners deepen their understanding of Django by exploring its advanced features and built-in libraries. Django is a high-level Python web framework that promotes rapid development and clean, pragmatic design. This course provides hands-on experience in leveraging Django’s powerful tools to build scalable, efficient, and secure web applications.

Enroll Free: https://www.coursera.org/learn/django-features-libraries

#python #programming #developer #programmer #coding #coder #softwaredeveloper #computerscience #webdev #webdeveloper #webdevelopment #pythonprogramming #pythonquiz #ai #ml #machinelearning #datascience #django

https://xn--r1a.website/DataScience4
👍6
Data Management With Python, SQLite, and SQLAlchemy

In this tutorial, you’ll learn how to use:

1⃣ Flat files for data storage
🔢 SQL to improve access to persistent data
🔢 SQLite for data storage
🔢 SQLAlchemy to work with data as Python objects

Enroll Free: https://realpython.com/python-sqlite-sqlalchemy/

#python #programming #developer #programmer #coding #coder #softwaredeveloper #computerscience #webdev #webdeveloper #webdevelopment #pythonprogramming #pythonquiz #ai #ml #machinelearning #datascience #django #SQLAlchemy #SQLite #SQL

https://xn--r1a.website/DataScience4
Please open Telegram to view this post
VIEW IN TELEGRAM
👍8
Build a Blog From Scratch With Django

🐍 In this #Django beginner project, you'll build a blog from scratch with the Django web #framework. You'll leverage the Django admin site and explore how to work with forms so your visitors can comment on your posts.

Link: https://realpython.com/build-a-blog-from-scratch-django/

https://xn--r1a.website/addlist/8_rRW2scgfRhOTc0
Please open Telegram to view this post
VIEW IN TELEGRAM
👍7
🖥 Django Extensions is a popular package for #Django that provides a set of additional tools and extensions for developing applications!

🌟 It includes management commands, models, decorators, and other utilities that simplify the development and testing of Django projects. The package is often used to optimize the workflow and add functionality that is missing from the standard version of Django.

🔐 License: #MIT

🖥 Github

https://xn--r1a.website/DataScience4 ❤️
Please open Telegram to view this post
VIEW IN TELEGRAM
👍81
Topic: Django Models and ORM — From Basics to Advanced Queries

---

What is a Model in Django?

• A model in Django is a Python class that defines the structure of your database table. Each model maps to a table, and each attribute represents a column.

Django uses its ORM (Object-Relational Mapping) to interact with the database using Python code instead of SQL.

---

Creating Your First Model

from django.db import models

class Book(models.Model):
title = models.CharField(max_length=200)
author = models.CharField(max_length=100)
published_date = models.DateField()
pages = models.IntegerField()


---

Making Migrations

• Create and apply migrations to sync models with the database:

python manage.py makemigrations
python manage.py migrate


---

Using the Model

# Creating a new record
book = Book(title="1984", author="George Orwell", published_date="1949-06-08", pages=328)
book.save()

# Fetching all books
books = Book.objects.all()

# Filtering
orwell_books = Book.objects.filter(author="George Orwell")

# Getting one object
book = Book.objects.get(id=1)

# Updating
book.title = "Animal Farm"
book.save()

# Deleting
book.delete()


---

Model Field Types

CharField, TextField, IntegerField, FloatField, DateField, DateTimeField, BooleanField, EmailField, and more.

---

Meta Class for Model Options

class Book(models.Model):
title = models.CharField(max_length=200)

class Meta:
ordering = ['title'] # default ordering by title


---

Relationships Between Models

One-to-Many (ForeignKey)
Many-to-Many (ManyToManyField)
One-to-One (OneToOneField)

class Author(models.Model):
name = models.CharField(max_length=100)

class Book(models.Model):
title = models.CharField(max_length=200)
author = models.ForeignKey(Author, on_delete=models.CASCADE)


---

Advanced ORM Queries

# Complex filters
books = Book.objects.filter(published_date__year__gte=2000, pages__lte=300)

# Exclude
books = Book.objects.exclude(author="J.K. Rowling")

# Ordering
books = Book.objects.order_by("-published_date")

# Count
total = Book.objects.count()


---

Summary

Django models define your database structure.

• The ORM allows you to query and manipulate data using Python.

• Supports relationships, complex filtering, ordering, and aggregation.

---

Exercise

• Create two models: Author and Book. Link them using a foreign key. Then, write views that:

1. Add a new book.
2. List all books by a specific author.
3. Delete books published before the year 2000.

---

#Django #WebDevelopment #ORM #DatabaseModels #DjangoTips

https://xn--r1a.website/DataScience4
5