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?
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.
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!
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.
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.
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
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 ?
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.