Creating Forms From Models in Django With ModelForm

  Рет қаралды 47,672

Pretty Printed

Pretty Printed

Күн бұрын

Пікірлер: 28
@prettyprinted
@prettyprinted 4 жыл бұрын
Join my free course on working with the database and models in Django: prettyprinted.com/djangodatabase
@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 4 жыл бұрын
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!
@xtremehackerzpro9511
@xtremehackerzpro9511 7 жыл бұрын
Nice video, especially part of object updating, keep going :)
@i701Dev
@i701Dev 3 жыл бұрын
What about a model that has relations? Can you do a video on that?
@abdelmoumenamine891
@abdelmoumenamine891 4 жыл бұрын
best tutorial i have seen
@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.
@AsaduzzamanSohel
@AsaduzzamanSohel 7 жыл бұрын
When will you start Django rest API tutorial? I will wait for this.
@prettyprinted
@prettyprinted 7 жыл бұрын
I'm thinking next week.
@greetingsgentlemen.8179
@greetingsgentlemen.8179 4 жыл бұрын
@@mounika_bathina um ya learn
@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 ?
@SrimalSamarasooriya
@SrimalSamarasooriya 6 жыл бұрын
I'm trying this. and I get AttributeError: 'tuple' object has no attribute '_meta' . Any thoughts
@prettyprinted
@prettyprinted 6 жыл бұрын
What line gives you that error?
@pedrobianchi1929
@pedrobianchi1929 6 жыл бұрын
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 6 жыл бұрын
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 6 жыл бұрын
Hey can u make a video on CreateView uploading images with foreign key involved
@prettyprinted
@prettyprinted 6 жыл бұрын
I'll consider it. Thanks for the idea.
@TheShash1001
@TheShash1001 7 жыл бұрын
Great video
@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
@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
Pretty Printed
Рет қаралды 194 М.
Adding Extra Fields On Many-To-Many Relationships in Django
17:45
Pretty Printed
Рет қаралды 43 М.
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
Django Forms Tutorial For Beginners - Get Started Fast! (2018)
29:36
The Dumbfounds
Рет қаралды 166 М.
Learn the basics of Django's Model Managers and Querysets
19:38
Matt Freire
Рет қаралды 44 М.
Using the Inline Form Set Factory in Django (Part 1 of 2)
19:31
Pretty Printed
Рет қаралды 59 М.
How Model Queries Work in Django
27:47
Pretty Printed
Рет қаралды 95 М.
The Basics of Django Models
37:32
Pretty Printed
Рет қаралды 99 М.
Try DJANGO Tutorial - 23 - Django Model Forms
7:38
CodingEntrepreneurs
Рет қаралды 110 М.
Extend Your Django User Framework With a One To One Field
11:39
Pretty Printed
Рет қаралды 42 М.
AJAXify Django Forms // Django Tutorial // Learn Python Django
27:19
CodingEntrepreneurs
Рет қаралды 63 М.
Custom Django User Model // DJANGO Tutorial
1:04:40
CodingEntrepreneurs
Рет қаралды 156 М.
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.