https://github.com/bikramai/django-orm-and-admin-site
Build the connection between DB. An object relational mapper, as the name implies, maps objects to relational records and that freezes us from writing a lot of repetitive code. So using an ORM, we don’t have to write SQL code to query or manipulate data
https://github.com/bikramai/django-orm-and-admin-site
database django-orm filtering managers-querysets retrieve-data
Last synced: 2 months ago
JSON representation
Build the connection between DB. An object relational mapper, as the name implies, maps objects to relational records and that freezes us from writing a lot of repetitive code. So using an ORM, we don’t have to write SQL code to query or manipulate data
- Host: GitHub
- URL: https://github.com/bikramai/django-orm-and-admin-site
- Owner: Bikramai
- Created: 2024-11-06T12:09:08.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-12-03T12:26:17.000Z (6 months ago)
- Last Synced: 2025-02-09T05:41:26.694Z (4 months ago)
- Topics: database, django-orm, filtering, managers-querysets, retrieve-data
- Language: Python
- Homepage:
- Size: 184 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Django + Python Part - 1
# Django-ORM + Database SQL + Admin-Site
Object-Relational Mappers(ORM) and the problem they try to solve. So we know that in realtional databases, data is stored as rows in tables. So when pulling up data from a relational database, we need to map these rows into objects. In the past, we used to do this by hand. And this was pretty repetitive and time consuming. So we would have to write a SQL query, send it to database, read the results, and mapped it a bunch of objects. So for each record, we will have to create a new object and set its attributes. This is where an object relational mapper comes into the picture. An object relational mapper, as the name implies, maps objects to relational records and that freezes us from writing a lot of repetitive code. So using an ORM, we don’t have to write SQL code to query or manipulate data, we can code in an object oriented programming language like Python, the ORM will then translate our Python code into SQL code at runtime.
## Benefits
- Reduce Complexity in Code
- Make the code more understandable
- Help us get more done in less time## Django-ORM Keywords We Learn
- Creating and Setup Database
- Managers and QuerySets
- Retrieving Objects
- Filtering Objects
- Complex Lookup Using Q Objects
- Referencing Fields using F Objects
- Sorting
- Limiting Results
- Selecting Fields to Query
- Deferring Fields
- Selecting Related Objects
- Aggregating Objects
- Annotating Objects
- Calling Database Functions
- Grouping Data
- Working with Expression Wrappers
- Querying Generic Relationships
- Custom Managers
- Understanding QuerySet Cache
- Creating Objects
- Deleting Objects
- Transactions
- Executing Raw SQL Queries# Django Admin Site
The Django Admin site is a powerful built-in
feature that allows you to easily manage your
application's data through a web interface.
It's a great tool for creating, reading, updating,
and deleting (CRUD) operations on your database models- Setting Up the Admin Site
- Registering Models
- Customizing the List Page
- Adding Cmputed Columns
- Selecting Related objects
- Overriding the Base QuerySet
- Providing Links to Other Pages
- Adding Search to the List Page
- Adding Filtering to the List Page
- Creating Custom Actions
- Customizing Forms
- Adding Data Validation
- Editing Children Using Inlines
- Using Generic Relations
- Extending Pluggable Apps