Try DJANGO Tutorial - 31 - Delete and Confirm

preview_player
Показать описание
Try DJANGO Tutorial series is here to teach you Django bit by bit.

Рекомендации по теме
Комментарии
Автор

Hey @CodingEntrepreneurs, did you missed the urls.py part? Something like:

urlpatterns [
# ...
path(products/'<int:id>/delete', views.product_delete_view, name="product_delete"),

RodrigodeLimaVieira
Автор

Wow mate! I look forward to your content! I was wondering How about analyzing data and plotting graphs in django admin! Again Great content buddy!

helloworld
Автор

in your url pattern,
if you write /delete instead of /delete/, upon clicking the yes button it brings you back to the page of product you are supposed to be deleting without deleting it. took me a while to figure out what i did wrong

brucebergkamp
Автор

@CodingEntrepreneurs
but how now returning ID =1 in database when Im lost it? :)

radekkrzyzak
Автор

As always, awesome tutorials! i'm looking forward for more videos! :D

odddellarobbia
Автор

it's worth discussing the PRG model so the site redirects after the POST request. You can add return after obj.delete().

racket
Автор

Please can you do a tutorial on how to display the form input in the browser for confirmation (like a form preview) before the data is actually saved into the database. Sometimes a user can misspell somethings. I have tried django formtools but the documentation is too scanty. Thanks for the great work you are doing.

hamzabawumia
Автор

Hey! I have a problem deleting: when I had " if request.method == "POST": : It didn't delete. but when I removed it, the post has been deleted.

sepidehfalah
Автор

how do you implement category and sub-category for products in the model ?

onlinetimenow
Автор

Friend, I hope you are still sharing knowledge, I am stuck just at this stage of the delete, I have a registration list contemplating other Models with FK, however, only one responsible for the User, how did I manage to create a delete condition?
I tried this way, but without success, because when I delete records from the second module I get a warning: No Table1 matches the given query.

def delete_slot2(request, pk):
user = Table1(user=request.user)
slot2 = get_list_or_404(Table2, pk=pk)
slot1 = get_list_or_404(Table1, pk=pk)
if request.method == 'POST':
slot1.delete()
return
slot2.delete()
return
else:
return render(request, 'delete.html', {'slot1':slot1, 'slot2':slot2})

eduardoguido
Автор

Can you try vibora python web frameworks and show it

ajf
Автор

make a tutorial on dynamic form generation please.

vincenzomarturano