Build An Event Approval Page With Checkboxes - Django Wednesdays #43

  Рет қаралды 16,362

Codemy.com

Codemy.com

Күн бұрын

Пікірлер
@Codemycom
@Codemycom 2 жыл бұрын
▶️ Watch Entire Django Wednesdays Playlist ✅ Subscribe To My KZbin Channel: bit.ly/35Xo9jD bit.ly/2IGzvOR ▶️ See More At: ✅ Join My Facebook Group: Codemy.com bit.ly/2GFmOBz ▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt! Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN ▶️ Get The Code bit.ly/3sJpeV6
@jasondavis6850
@jasondavis6850 2 жыл бұрын
Thanks again for the series. Here's a way to send checked and unchecked values to the database. I'm only a newb to python/django so it took me a lot longer than 5 minutes. Enjoy! def admin_approval(request): event_list = Event.objects.all().order_by('-event_date') events_all = Event.objects.all() events_all_ids = [] for i in range(0, len(events_all), 1): events_all_ids.append(str(events_all[i].id)) if request.user.is_superuser: if request.method == 'POST': id_list_true = request.POST.getlist('boxes') for x in id_list_true: Event.objects.filter(pk=int(x)).update(approved=True) id_set_false = set(events_all_ids) - set(id_list_true) id_list_false = list(id_set_false) for y in id_list_false: Event.objects.filter(pk=int(y)).update(approved=False) messages.success(request, ('Event List Approval has been updated')) return redirect('events_list') else: return render(request, 'events/admin_approval.html', { 'event_list': event_list }) else: messages.success(request, ('You are not authorized to view this page.')) return redirect('home')
@mateuszbaszkowski1429
@mateuszbaszkowski1429 2 жыл бұрын
Man, youre doing great job. I was just struggling with checkboxes on my very first app. Thanks a million.
@Codemycom
@Codemycom 2 жыл бұрын
Happy to help!
@aldya1532
@aldya1532 2 жыл бұрын
Very simple and nice solution! Thanks a lot! And thanks for your wonderful English)
@Codemycom
@Codemycom 2 жыл бұрын
Welcome
@hemantsah8567
@hemantsah8567 2 жыл бұрын
I spent 2 hours working on this kind of issue, thanks to your video,
@stardust_dweller
@stardust_dweller Жыл бұрын
This helped me so much! Thank you!
@Codemycom
@Codemycom Жыл бұрын
Welcome!
@prakalpitneupane9253
@prakalpitneupane9253 2 жыл бұрын
I needed to do the same, your video saved my day 😃
@Codemycom
@Codemycom 2 жыл бұрын
awesome
@skyline-wd3gr
@skyline-wd3gr 2 жыл бұрын
You are my favorite KZbinr
@Codemycom
@Codemycom 2 жыл бұрын
Thanks!
@skyline-wd3gr
@skyline-wd3gr 2 жыл бұрын
I have implemented many things in my python project by watching your videos
@Codemycom
@Codemycom 2 жыл бұрын
Glad to hear it!
@kodeypatterson8973
@kodeypatterson8973 2 жыл бұрын
Great video, thanks a lot. I've been following for a while
@Codemycom
@Codemycom 2 жыл бұрын
Thanks for watching!
@eesakamaldien1917
@eesakamaldien1917 2 жыл бұрын
I love your videos always the best
@Codemycom
@Codemycom 2 жыл бұрын
Thanks!
@darthvader66
@darthvader66 2 жыл бұрын
Nice video and great explanation! Is it better to have Event.objects.filter(pk__in=id_list).update(approved=True) instead of hitting the database n times seperately in the for loop?
@anilkumar-ug3yd
@anilkumar-ug3yd 2 жыл бұрын
If you have lots of rows and u want to use pagination filter and builk update and delete by checkbox. what should be done ?
@ZAYN_ONE_DIRECTION
@ZAYN_ONE_DIRECTION 2 жыл бұрын
Sir you had a video on adding images to buttons in tkinter. Does the same method shown in the video also work for buttons in a canvas?
@Codemycom
@Codemycom 2 жыл бұрын
Try it and see
@thomasnowak9825
@thomasnowak9825 2 жыл бұрын
For this, is it worth covering checking dates and times of events? For example, if someone entered an event and then someone else entered an event with the same date and time, it would be cool to reject the last one saying there is already an event for that date and time.
@Codemycom
@Codemycom 2 жыл бұрын
Why can’t there be two events at the same time?
@thomziq
@thomziq 2 жыл бұрын
Hey:) Is there a possibility to add Matplotlib graphs to Django? Maybe some stats about Events?
@Codemycom
@Codemycom 2 жыл бұрын
Probably, though I don't have any videos on it
@Adrian-mh8op
@Adrian-mh8op 2 жыл бұрын
Would you know how to create leaderboards in python. Do you have any videos for that
@Codemycom
@Codemycom 2 жыл бұрын
Sorry, don't know what you mean by leaderboards
@Adrian-mh8op
@Adrian-mh8op 2 жыл бұрын
I’m doing a python flashcard app, it tree ore where users enter details and it gets submitted into a database. But I want to do a leaderboard which ranks the most correct answers from users. Do u have any vids on that or know how to begin doing that
@Codemycom
@Codemycom 2 жыл бұрын
I have tons of videos about getting data from a database and displaying it on a screen. Nothing specific about leaderboards, but it would be trivial to order by whatever.
@tonystark3399
@tonystark3399 2 жыл бұрын
Sir can you please make a video on making scientific calculator with kivy ?
@Codemycom
@Codemycom 2 жыл бұрын
I've already done a calculator with kivy. Just add the scientific functions you want.
@sinacoder
@sinacoder 2 жыл бұрын
💻☕🍔🍟
@Codemycom
@Codemycom 2 жыл бұрын
:-)
@hiwab41
@hiwab41 2 жыл бұрын
First
@Codemycom
@Codemycom 2 жыл бұрын
Nice!
@tariqjahhaf7113
@tariqjahhaf7113 Жыл бұрын
Your efforts are honorable.. Thanks alot.. and for the checkbox issue you are not updating the unchecked Events, This is how I solved that: events = Event.objects.all().order_by('-date', 'name') context = { 'events': events } all_true_list = [] for event in events: if event.approved: all_true_list.append(str(event.id)) if request.user.is_superuser: if request.method == 'POST': checked_id_list = request.POST.getlist('boxes') for item in all_true_list: if item not in checked_id_list: Event.objects.filter(pk=int(item)).update(approved=False) else: pass for item in checked_id_list: Event.objects.filter(pk=int(item)).update(approved=True) messages.success(request, "Events updated") return redirect('events_list.html') else: return render(request, 'events_list.html', context) else: messages.success(request, "You are not authorized to view this page") return redirect('home')
Count The Number Of Events and Venues - Django Wednesdays #44
7:30
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
Use Different Forms For Different Users - Django Wednesdays #30
13:34
Adding a session timeout in Django
15:44
Cloud With Django
Рет қаралды 10 М.
Pagination For Django - Django Wednesdays #18
18:53
Codemy.com
Рет қаралды 43 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 492 М.
Django ORM Primer - Django QuerySet API and QuerySets
15:07
Very Academy
Рет қаралды 10 М.
Django Update Image Deletion with Signals
21:07
Very Academy
Рет қаралды 1,6 М.
How is this Website so fast!?
13:39
Wes Bos
Рет қаралды 1,2 МЛН