61 - Manage QuerySets with Django Formsets + modelformset factory - Python & Django Tutorial Series
ฝัง
- เผยแพร่เมื่อ 23 ส.ค. 2024
- 61 - Manage QuerySets with Django Formsets and modelformset factory -Python & Django 3.2 Tutorial Series
Try Django 3.2 is a series to teach you the fundamentals of creating web applications with Python & Django by building a real project step-by-step.
⦿ Playlist: • Try Django 3.2 - Pytho...
⦿ DigitalOcean $100 Promo: do.co/cfe-youtube
⦿ Code: github.com/cod...
⦿ Subscribe: cfe.sh/youtube
⦿ Setup Video for Python 3 & Django 3: • Install & Setup Python...
Hi Justin! I apretiate a lot your work, very clear and neat explanations. I am following these series for a week :)
I just want to mention that the if-statment (if child.recipe is None) in 7:40 will cause an exception and as django docs suggest it's better to use the python function hasattr:
if not hasattr(child, 'recipe'):
child.recipe = parent
I am sure you solved this issue later on, but just in case :)
Good call! Thanks
It helps a lot!!! Thank you very much!!!
Thank you so much i was waiting gor this .
thank you bro i really need it
looking for this .Thankyou so much
Hi I have ben following this tutorial for some other app i was working on but I'm stuck here for quite some time. For some reason i keep getting ( (hidden field total_Forms, initial_form) this is required) on my page right before i put the formset tag.
can you help me with that?
Thanks very much Justin. Well explained.
Here is something interesting and that I am curious about. When I use "{{formset.as_p}}" in the html template everything works fine. I can edit and change the values no problem. When I refresh the page/ check the admin the values are indeed changed.
However once I try rendering the values in the forms differently any updates I do on the (front-end) form won't take effect after saving. How is that? That makes literally no sense to me.
To clarify I use something like this on the front-end template for example:
{% for ingredient_form in formset %}
{{ingredient_form.name}} ....
{%endfor %}
It all renders out fine but as mentioned any values changed on the site won't "stick" once saved.
PS: Actually never mind. That's all explained 2 videos later. Thanks a lot 😊
instead of teaching the way of NOT to do something, you must teach DIRECTLY de CORRECT way of doing it, because students may confuse thinking someting you just did is the correct way, at the end you ALWAYS say "THIS IS NOT THE CORRECT WAY OF DOING THIS..." and change everything we (the students) thought it was correct. that is not good practice teaching. even the videos would be shorter if you don't do that