Тёмный

Creating Forms From Models in Django With ModelForm 

Pretty Printed
Подписаться 96 тыс.
Просмотров 48 тыс.
50% 1

Опубликовано:

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 28   
@prettyprinted
@prettyprinted 4 года назад
Join my free course on working with the database and models in Django: prettyprinted.com/djangodatabase
@xtremehackerzpro9511
@xtremehackerzpro9511 6 лет назад
Nice video, especially part of object updating, keep going :)
@Omni_G
@Omni_G 6 лет назад
Hi Anthony, one thing I always find confusing is when to use which. Like, when do I use Form? When do I use ModelForm? When do I use View? When do I use Generic View?
@prettyprinted
@prettyprinted 6 лет назад
Use a ModelForm when your form is very closely related to the model. Use generic view if you're doing something that a generic view gives you, like displaying a single item out of the database or a list of items.
@Omni_G
@Omni_G 6 лет назад
Wait, can a normal view not display a single item out of the database with get()?
@prettyprinted
@prettyprinted 6 лет назад
Yeah, a normal view can do anything. The generic views are just shortcuts.
@jacksorjacksor
@jacksorjacksor 3 года назад
If ever I'm stuck and I see there's a Pretty Printed video about it I breath out a sigh of relief
@theshahrukhfit3154
@theshahrukhfit3154 3 года назад
What I have noticed in all your videos is that you cover all the things. I watched many form model videos no one showed how to use the instance parameter which I really was confused about. Somehow I knew you would cover that. Thanks for not letting me down. You are awesome!
@praveenkumar-bz3qi
@praveenkumar-bz3qi 4 года назад
I liked this video, also i watched your many django and flask videos. Could you please make a video on django-select2 module ?
@AsaduzzamanSohel
@AsaduzzamanSohel 6 лет назад
When will you start Django rest API tutorial? I will wait for this.
@prettyprinted
@prettyprinted 6 лет назад
I'm thinking next week.
@greetingsgentlemen.8179
@greetingsgentlemen.8179 3 года назад
@@mounika_bathina um ya learn
@i701Dev
@i701Dev 2 года назад
What about a model that has relations? Can you do a video on that?
@TheShash1001
@TheShash1001 6 лет назад
Great video
@SrimalSamarasooriya
@SrimalSamarasooriya 5 лет назад
I'm trying this. and I get AttributeError: 'tuple' object has no attribute '_meta' . Any thoughts
@prettyprinted
@prettyprinted 5 лет назад
What line gives you that error?
@akshi.b
@akshi.b 6 лет назад
Ah man where have you been my whole life????
@akshi.b
@akshi.b 6 лет назад
Can you help me out a little bit? So I've created a URL shortener. I'm totally new to django so half of the time I don't know what I'm doing. So I created it for a single url but want to upgrade it so that user can add multiple url at the same time and shorten them. The url input is taken in form.py and I added a ''+'' button in my home.html, it has a submit button too. Now I want an array to be created for my multiple url and send request for each added entry to shorten it. How do I do this? Also I want my page not to reload so I have to use ajax right? I'm so confused. The app is working fine for single url shortening.
@prettyprinted
@prettyprinted 6 лет назад
If you want to send the request on each click of the + button, then yeah you'll need to use JavaScript and AJAX. Look into my sending request without page refresh videos here.
@akshi.b
@akshi.b 6 лет назад
that's only sending request, but how do I pass the array strings one by one in database? do you have a video for that? I couldn't find it. If you do please share the link
@abdelmoumenamine891
@abdelmoumenamine891 3 года назад
best tutorial i have seen
@pedrobianchi1929
@pedrobianchi1929 5 лет назад
I have a question. If I did have more than one model field, the app creates more than one form , right? But how do I express those different forms in the html file separately? Like I have one model for name and another for company, and I use the ModelForm, then, the app will create more than one form, and I want to express these forms in different places of my web or html file, what do I do ?
@prettyprinted
@prettyprinted 5 лет назад
Just give each form a more unique name than 'form' Then you can place multiple of those generated forms in your tag in your HTML. Everything else will work the same.
@nikhilbhardwaj6055
@nikhilbhardwaj6055 5 лет назад
Hey can u make a video on CreateView uploading images with foreign key involved
@prettyprinted
@prettyprinted 5 лет назад
I'll consider it. Thanks for the idea.
@looploop6612
@looploop6612 4 года назад
why use meta?
@alisadeghi6933
@alisadeghi6933 5 лет назад
thanks for this video 😉
@prettyprinted
@prettyprinted 5 лет назад
You're welcome! Thanks for watching.
Далее
Deploy a Django App to Python Anywhere
15:11
Просмотров 194 тыс.
Лайфак года 😂
00:12
Просмотров 63 тыс.
荧光棒的最佳玩法UP+#short #angel #clown
00:18
Django Authentication Basics
19:38
Просмотров 109 тыс.
The Basics of Django Models
37:32
Просмотров 99 тыс.
Dynamic Django forms without writing any JavaScript
27:07
Django & HTMX - Dynamic Form Creation and Submission
24:36
How Model Queries Work in Django
27:47
Просмотров 95 тыс.
Understanding Django Model Relationships
25:56
Просмотров 94 тыс.
Python Django Forms tutorial
26:54
Просмотров 10 тыс.