Django - Database Constraints | Unique Constraint | Check Constraint

Published: 06 February 2024
on channel: BugBytes
2,967
135

In this video, we'll explore how to define database-level constraints using Django.

We'll see how we can apply constraints to our model fields - for example, unique constraints and check constraints, as well as not-null constraints - and will explore the effect these have on the underlying database table and columns.

☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
https://ko-fi.com/bugbytes

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
03:05 Types of Constraints
05:55 Defining Check Constraint in Django
14:47 Defining Unique Constraint in Django

▶️ Full Playlist:
   • Django ORM Deep Dive  

𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: https://bugbytes.io/posts/
👾 Github: https://github.com/bugbytes-io/
🐦 Twitter:   / bugbytesio  

📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
Django Constraints: https://docs.djangoproject.com/en/5.0...
Types of Constraints: https://www.ibm.com/docs/en/ias?topic...

#python #django #webdevelopment #sql