Django ORM - Model Field Validators / Writing Custom Validators / ModelForms

Описание к видео Django ORM - Model Field Validators / Writing Custom Validators / ModelForms

In this video, we'll look at Django model field validators, such as the MinValueValidator, MaxValueValidator, as well as writing our own custom validator functions.

We'll also briefly look at how ModelForms hook into models, and use the validators that are defined on fields on the model that are included in the ModelForm.

Finally, we'll see how ModelForm subclasses pull choices that are defined on a model field into the form as options in a select field.

To see more on using Validators, you can also check this video where we validate the FILE EXTENSION of an uploaded file using Django's FileExtensionValidator:
   • Django Media Files - Restricting Uplo...  

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:56 Using Django MinValueValidator & MaxValueValidator
06:09 Creating a ModelForm that uses model field validators
13:21 Writing custom validator functions
17:17 Using Choices in Django forms

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

▶️ Full Playlist:
   • Django ORM Deep Dive  

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

📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
Django Validators: https://docs.djangoproject.com/en/4.2...
ModelForms: https://docs.djangoproject.com/en/4.2...

#python #django #webdevelopment #database #sql

Комментарии

Информация по комментариям в разработке