Don't forget to check out my Complete Django Course! dub.sh/NvGboTI
@sontustripura31334 жыл бұрын
Someone : Do you have any Good Django book? Me: yes, I have the best one book.this is dennis Ivy. Just love you man!
@DennisIvy4 жыл бұрын
Haha thanks man! your awesome :)
@tanjimashraf8034 жыл бұрын
I have completed a beginner Django course, where I've learned the basic CRUD functionalities along with REST API CRUD with Angular 2. But as I'm doing this course, I've realized I missed many little things that matter. A big thanks to you, brother 💙 Love from Bangladesh.
@pulkittiwari98353 жыл бұрын
u have my deep respect bro.....i have seen about all the django lectures of youtube....none can be comparable with you...great work
@muhammadukkasha5048 Жыл бұрын
I ususally don't coment on any video but watching this playlist I would say that you are GEM man. Much appriciate to your efforts.
@ryan_03375 жыл бұрын
I discovered you since you start your channel and follow you is the best investment I made. You bring a lot of value with your expertise and put a lot of efforts to make clear explanation. I hope you will continue to put content in the future. Thank's for you work in this tutorial Dennis
@DennisIvy5 жыл бұрын
Thank you Ryan! :)
@arthdave73134 жыл бұрын
Hey, man I am doing my MS in Computer Science, and I would definitely say that things I have learnt from this channel is way more valuable than what I have learnt at school. Thanks for sharing the knowledge. Just one suggestion. It would be great if you can keep some exercise after the completion of the topics you cover in the video.
@thexengengineer38704 жыл бұрын
Hello Denny, I was searching for user login & login permission-based views in Django for a week until I landed on your tutorial. Tried a lot of tutorials, but not a single one covered things as profoundly as you did. Thanks a lot. Much love !
@ShivamSingh-bx5lg4 жыл бұрын
Dude, you are simply great. Please do an In-depth DRF tutorial and combine it with React, as there are not many tutorials on DRF available.
@deadnetworksdead5963 жыл бұрын
Great Video! One thing, for others that are watching, though. If you want to have multiple groups and your group, you are searching for, happens to be on any other than the first place of the array you wont get the results you want. Modifying the code as follows works for me: def allowed_roles(allowed_roles=[]): def decorator(view_func): def wrapper_func(request, *args, **kwargs): group = None if request.user.groups.exists(): for group in request.user.groups.all(): if group.name in allowed_roles: return view_func(request, *args, **kwargs) return HttpResponse('You are not authorized to view this page') return wrapper_func return decorator
@PGTechBar3 жыл бұрын
One of the best tutorials I have ever seen. The clean and simple way of demonstration.
@doniyorabduvokhidov17064 жыл бұрын
Previous tutorials were somehow easy but this one is a real pain. Have to watch and analyze couple of times. BTW, i want to say tons of thanks for u for this amazing content!
@yvyas964611 күн бұрын
True though 😄
@jessjoshi4 жыл бұрын
you are jut amazing .. I tried to learn django last year . but no luck .. but this month I found you .. and everything just making sense and not hard at all.
@junecnol794 жыл бұрын
4:10 authentication check with python generator 10:02 authorization check with python nested generator 17:05 admin only authorization check
@raparthipoornachanderrao51214 жыл бұрын
Thank you for giving this . I searched but like this video there is no other video.good explained.
@zoljargalenkhtaivan96613 жыл бұрын
All your projects are so great. Big thank from Mongolia
@loksewabyte5 жыл бұрын
You call it as a Django Crash course But its A really Corporate Level course . You are the best KZbinr ever in KZbin in context of Django tutorials.Thank you a lot For such powerful Content. Please upload more video on django advanced topics like djnago signals, Resst Framework and more
@DennisIvy5 жыл бұрын
Thank you thank you thank you!!! :)
@loksewabyte5 жыл бұрын
@@DennisIvy Sir please upload Video On Django Rest Framework After completing this series
@UBLAunripped4 жыл бұрын
Dennis we REALLY appreciate all your hard work with these videos - we have gained SO much - thank you
@iajitpatil4 жыл бұрын
Your tutorial is awesome, it is really helping big time.. You almost taught entire Django for free !!!
@gulsabafiha15684 жыл бұрын
Thank you very much Dennis. It's really very salutatory for us and for those who want to learn django with the best outcome. much love for you man!
@microtech51312 жыл бұрын
Massive Respect Broo....Really appreciate for the nice content you upload for....Am doing a python / Django project and most of your content has helped me solve a few problems here and there and also taught me things i dint know how to solve..
@OlushiyanIbukunoluwa2 жыл бұрын
yo man, looking to work on a django project myself - care to connect to discuss?
@mugumyavicent28033 жыл бұрын
i have followed your videos, they are nice,,, thanks for teaching the entire world, you deserve some tea from me. May you keep blessed ... ever
@sundarali8454 жыл бұрын
This one was a little bit complicated but i think i couldnt have found better explanation else where...Love u course..been following this series from part 1
@supritkumar26244 жыл бұрын
Thank you very much for all your great lession through this course .It cleared some of the doubts previously i had.This course will be helpful after many decades also . M from India #Support you
@kate_chengdu4 жыл бұрын
your course is helping me with my project a lot. thank you!
@NOMOUSE2 жыл бұрын
Dude, I don't speak English but I love to learn these things... you are fantastic! Thank you so. I just couldn't get vscode to recognize decorators as a module, so I inserted my decorations into views, py anyway. Cheers!
@travistheall52604 жыл бұрын
I have been looking for a video like this for so long. Happy I found your channel man
@DennisIvy4 жыл бұрын
Glad this helped! Thank you so much for your feedback :)
@yahialinus185110 ай бұрын
your content is pure diamond
@darren11074 жыл бұрын
Love this tutorial. I would love to see you turn this into a backend api with django rest framework and handle the front with Vue or React! I've completed most of your videos working along, super helpful. Well done.
@Shawn-tw3pg3 жыл бұрын
This lesson is very clear and detail, and it helps me a lots! Thank you very much : )
@valentinfontanger49624 жыл бұрын
I needed to find a way to shorten my code in my view and this is the perfect video ! Thank you !
@ShaunDePonte4 жыл бұрын
This app will work REALLY well if it's integrated into your e-commerce app as an admin/staff/management view
@migueljr61474 жыл бұрын
Hey dude, it was a amazing class! Thank y very much to share it! You have a giant knowledge with python/django.
@samarthgodase10114 жыл бұрын
The Best Django Tutorial Ever!
@mohammedbasheeruddinbilal30704 жыл бұрын
One of the best Django tutorials!!
@lewiseman4 жыл бұрын
love your work :) Also note if you try to log in with the superuser account after adding the @admin_only decorator you will receive an error since its not in the groups specified
@gebreajax3227 Жыл бұрын
I have completed your crash course, and it helps me a lot, thank you so much. If You have a react crash course please put the links here.
@sandrakuczynska34874 жыл бұрын
Dennis, thank you for this tutorial. It's great. But I have a problem with the decorator @allowed_users. I'm getting this error: Exception Type: ValueError Exception Value: The view accounts.decorators.wrapper_function didn't return an HttpResponse object. It returned None instead. Can you help me?
@sandrakuczynska34874 жыл бұрын
I think that something is wrong in db (while creating a user), because when you logged into admin panel and hit "Home › Authentication and Authorization › Users › Dennis" - then you have "Groups" field and there is a "customer" and in the field "Chosen groups" you have "admin", unlike you, when I hit my admin's name, I don't have Groups it in this place , I have an empty field. That's why the decorator doesn't work. How can I fix that?
@mattclagett7784 жыл бұрын
I fixed this issue - I was logged into a user that did not have admin privileges. Went into DB and gave admin and now it works
@samuelairadion89914 жыл бұрын
simple..when creating your Group at your admin page. make sure the group names eg admin, customer is exactly the same with the string 'admin' and 'customer'. at your decorators.py file.this causes the error..like in my case i missplelled mine as Admin and Customers..
@ajithr12554 жыл бұрын
Add the following under the admin_only function in decorators.py: if group == 'customer': return HttpResponse('You are not authorised to view this page.')
@agungm62064 жыл бұрын
@@mattclagett778 thanks a lot man, you just save a day
@amrelkholy6662 Жыл бұрын
one of the magic videos, you are really amazing
@amitroth20114 жыл бұрын
How can i create the same implementation with CBV?
@muhammadibrahimnoor99154 жыл бұрын
HEY, what could be the ideal way to fix the problem you mentioned at 16:50? Thanks
@pawanchhangani75284 жыл бұрын
allowed roles basically why we use to it. Only we have to check whether a user is superuser or not for that we can use if request.user.is_superuser: he will be able to see the view otherwise not
@alinandrei90064 жыл бұрын
I'm gratefull for these series.
@ahmedbenyahia68534 жыл бұрын
Really thank you so much for sharing this tutorial, really great and opens so many horizon !!! Great work men
@KingQAT4 жыл бұрын
I keep getting this error "ValueError: The view accounts.decorators.wrapper_function didn't return an HttpResponse object. It returned None instead." any clue how to solve it, my code wasnt doing it properly so i copy pasted the source code and lined it up with mine
@stagecoachmechanic4 жыл бұрын
I keep getting the same problem...
@ateebasif53604 жыл бұрын
else: # return HttpResponse('you are not authorized to view this page') return redirect('user-page') use this in else tag comment out or remove the HttpRespnse and write just return redirect('user-page') and in the views.py use allowed_user decorator instead of admin only your error will be removed
@samuelairadion89914 жыл бұрын
simple..when creating your Group at your admin page. make sure the group names eg admin, customer is exactly the same with the string 'admin' and 'customer'. at your decorators.py file.this causes the error..like in my case i missplelled mine as Admin and Customers..
@chandrashekharsahani64824 жыл бұрын
when you change the permission from admin panel like ' user1 to admin and user2 to customer you forgot to press save button ' so click on save. it will work .
@ajithr12554 жыл бұрын
Add the following under the admin_only function in decorators.py: if group == 'customer': return HttpResponse('You are not authorised to view this page.')
@machinimaaquinix31784 жыл бұрын
For those following this tute and getting misc errors - be sure you are consistent in the usage of capitalization in the code files with the group names you created in the Django admin site. This will solve most errors.
@Victornuamah12 жыл бұрын
Hi Dennis. Your are one of the best instructors I have found on KZbin. Your 7 hours django crash course and this customer management course have helped me a lot in my django learning pathway. Base on the information I have attained from those courses, I have started a Church Management System but I want to allow members where necessary, to have multiple user roles incase they are serving in more than one departments. My problem is which page will they see after login to the system? Please help me Dennis, I really need help on this.
@nickrene Жыл бұрын
Thank you so much, this is a very helpful and great presentation by your side!
@athulksuresh91643 жыл бұрын
when I click on logout and then back button from the browser it shows me the home page. user type is not anonymous what to do
@peronneaumoliere2874 жыл бұрын
I love you! you are an amazing teacher! You make me love Django!
@ErWasiKhan Жыл бұрын
There is one problem, If admin adding new group. So I think the new group will not work. We do not want to modify the code at server level. Please suggest. I tried but failed. I think The route should fetch current user role/group then compare with the view function. Request you to please give solution. I stucked in this problem. Thanks in advance.
@dennismillanzi14758 ай бұрын
Hello, iam getting an Attribute error which reads “NONE TYPE” object has no attribute “Groups” can you please help
@BensonIbe Жыл бұрын
instead of return the Http response, I just return render the user page. so if you are not allowed to be there, it redirects your to where your should be. like this def allowed_users(allowed_roles=[]): def decorator(view_func): def wrapper_func(request, *args, **kwargs): group = None if request.user.groups.exists(): group = request.user.groups.all()[0].name if group in allowed_roles: return view_func(request, *args, **kwargs) else: return render(request, 'accounts/user.html') return wrapper_func return decorator see the else statement. is theis logic okay?
@appiah-kubifrank7378 Жыл бұрын
Hi am a beginner and am facing difficulties, please is it possible to purchase your source code and videos? so that i can study offline? thank you
@betopolione.laura.gil.17 ай бұрын
hey man, I love your videos, you are amaizng. Just a little unrelated question, I saw that some times you use camelCase for name funcions, and some times you use snake_case. Is there a reason for that? When should I use one or another? thanks
@k-webbs2 жыл бұрын
During registration, how do you ensure that you are checking if the user exists first before you create a new user?
@saivenkantamanikanta4 жыл бұрын
While I had done this in the admin only function I am getting the error as "cannot return the decorator so none object returned". Can u please rectify this error bro
@alfiandty4 жыл бұрын
me too bro
@nicholasvarela67114 жыл бұрын
same
@phucutube4 жыл бұрын
I was receiving this error as well. I suggest you go into your admin panel and make sure your user has the customer group assigned. I had mine assigned, but not saved. Also make sure your spelling is the same across the board.
@saivenkantamanikanta4 жыл бұрын
@@phucutube problem resolved and i forget to update the error bro
@machinimaaquinix31784 жыл бұрын
To clarify - be sure you keep the proper capitalization. In Dennis' code, admin and customer are lower case. If your groups begin with capital letters like so: "Admin" and "Customer" then you will get the error in the OP.
@yohannesayana94563 жыл бұрын
I followup all parts attentively and it works but i got the error in this part of the series....can u help me? the error says ValueError at / The view abiy.decorators.wrapper_function didn't return an HttpResponse object. It returned None instead.
@letswatch2693 Жыл бұрын
in 'admin_only' what is 'user-page' exactly ? I put there my 'Home' page but site show me ERR_TOO_MANY_REDIRECTS
@yeetergonzales8324 жыл бұрын
I had problem with ValueError at / The view accounts.decorators.wrapper_function didn't return an HttpResponse object. It returned None instead - and then I realized that my "admin" user was not added in admin group so I just added him in and all worked. So users added be4 this tutorial are not in any group. Hope it helped
@TrungNguyen-kt3lt3 жыл бұрын
For superuser role, I couldn't get it to work. Seems like there's no group name 'admin'. So I add this: elif request.user.is_superuser: return view_func(request,*args,**kwargs)
@serhiihoriaiev27674 жыл бұрын
Thanks for this super useful course! One remark: you shouldn't use mutable objects as default values to function parameters :) Привет из Украины!
@petermulhall70054 жыл бұрын
For some reason now all my tags are showing up as hyperlinks and forcing me to the login page. Weird. Any ideas how I might rectify this? Also the section on the dashboard page that list the last 5 orders is now below the customers section. Can anyone suggest a fix for these?
@felixaponati43189 ай бұрын
Hello Dennis That's a great job Can you make a video on how to integrate formstack in Django
@HenryKamandeN4 жыл бұрын
'NoneType' object is not callable , site-packages/django/contrib/auth/decorators.py in _wrapped_view, line 21 return view_func(request, *args, **kwargs) , TypeError: 'NoneType' object is not callable How do i fix these ?
@sayliwangikar72433 жыл бұрын
Why are we passing the parameters *args and **kwargs in wrapper_func??
@mychromebook99353 жыл бұрын
when was the user.html file created ? Seems it just appeared out of thin air.
@debashisgupta27904 жыл бұрын
how can i use this allowed_user decorator for classbased view. View_func works for function . it doesn't work for classbased view. please help me
@valentinfontanger49624 жыл бұрын
docs.djangoproject.com/fr/3.0/topics/class-based-views/intro/. you have a section about how to do it for class based views
@ahmadmubarak77444 жыл бұрын
My full code is correct but there is one error (The view accounts.decorators.wrapper_func didn't return an HttpResponse object. It returned None instead) Please tell me why this error occurs
@kubervarshney8509 Жыл бұрын
can anyone resolve this Reverse for 'user-page' not found. 'user-page' is not a valid view function or pattern name
@platov267 Жыл бұрын
Thank You you saved my job today
@Abh190214 жыл бұрын
Hi Dennis, I have a question. I have a simple blog and I want a user(suppose it's John) who has access to add new posts to only view his own posts and when he adds a new blog post from the admin, he should only be able to select his name as an author. How can I restrict this user to only select his name as the author and can only see his own posts? Thanks a lot
@kelvinkamau20334 жыл бұрын
Hi, great course Dennis. I have a question. Lets say You want to create a user and you want to associate the user with a specific group i.e Admin, Seller and Customer. I dont need the user to always be a customer like in the below code. group = Group.objects.get(name='Customer') user.groups.add(group) Is there a way i could select which group i want my user to belong to? i.e Like a dropdown which i could select the group.
@diegovicuna10214 жыл бұрын
The way to do back space is holding shift and press tab
@desmondabbah83723 жыл бұрын
Hello Dennis, please can you do a video for me on how to have email verification before allowing the user to login with the UserCreationForm and also do how to login with email instead of the username please. Thanks and really love your works
@gouthamgondrala52733 жыл бұрын
what if there are more than 2 groups how to assign then in the register page?
@OpenThisGate873 жыл бұрын
Hello. How does the loginPage() function know what form to use? Thanks!
@franco_bsnss74822 жыл бұрын
Dennis thanks for sharing your knowledge with us. After ending this course, which level would I have? Could I be able to make a simple website?
@shyamjaiswal80154 жыл бұрын
How can I give permission to my emplyoees to view only few of my customer pages, this help would really be appriciated
@nabinr.chaudhary99714 жыл бұрын
great explanation sir but how can i restricted user instance of is_staff
@mikaeldoctore82003 жыл бұрын
what theme did you use in your sublime text editor?? thanks
@petermulhall70054 жыл бұрын
Hi, when my 'customer' logs in and gets redirected to the 'user' page there is no css formatting. Any ideas of what I could have done wrong? it was working up to the point of putting the @admin_only decorator in place.
@TheLegendOfNiko4 жыл бұрын
How do you make it so that if a customer purchases a certain item, they are added to one of the allowed groups?
@srich-k4 жыл бұрын
That was simple and brilliantly explained Thanks!
@preetham49744 жыл бұрын
def unauthenticated_user(view_function) takes the function and its arguments (i mean register(request) ) as view_function argument or just the request argument in the register function as view_function ? thank you
@aanchalsharma52644 жыл бұрын
def home(request): TypeError: 'NoneType' object is not callable i am stuck here for2 days please help
@dradrigapatrick4 жыл бұрын
I ran into same problem too but i found the problem being with my naming convention. The names i called in the decorators wasnt matching the one set in the url.py Maybe you check their.
@akshaymhatre36693 жыл бұрын
How can we write test cases to test the allowed user decorator?
@francismacho90284 жыл бұрын
Dennis, thanks for this course. My question though is how do I iterate to check groups when user belongs to more than 1 group? I have a supervisor group, admin and sales staff group and a user can belong to supervisor and admin group. how do I iterate through without indexing the group manually?
@sankarganeshinfotech4 жыл бұрын
incase if the user belongs to multiple groups just use the below code. def allowed_users(allowed_roles=[]): def decorator(view_func): def wrapper_func(request, *args, **kwargs): group = None groups_list = [] if request.user.groups.exists(): for group in request.user.groups.all(): groups_list.append(group.name) # group = request.user.groups.all()[0].name if any(group in groups_list for group in allowed_roles): # if group in allowed_roles: return view_func(request, *args, **kwargs) else: return HttpResponse('You are not authorized to view this page') return wrapper_func return decorator
@samyan76294 жыл бұрын
Thank you ,Dennis. i am your fans
@vikasjoshi4754 жыл бұрын
This is really helpful for me .Thanks man!
@osantos774 жыл бұрын
Hi, Thank you for the awesome content! I have a question "what is the difference between using decorator and middleware in Django when applying roles and permission?"
@DennisIvy4 жыл бұрын
Just different ways to accomplish the same task. I personally prefer middleware because we can create all logic in one area rather than having to add a decorator over each view. I'll be putting something together on middleware in the future :)
@rodrigosegura24004 жыл бұрын
Hi @@DennisIvy! Do you still plan to upload the Middleware video?
@wissemcherif29822 жыл бұрын
thanks a lot!!! so nice reverb
@technoinfoworldwide23295 жыл бұрын
django.contrib.auth.decorators import login_required @login_required(login_url='login') I had use same to same your code but it doesnt work for me ,can you please help me? is it because i havent put logout option?it is necesary to work for logout option and then these above functionality works ?
@DennisIvy5 жыл бұрын
Yes if you haven't worked with the decorators then just go ahead and remove them because it will cause an error. If your still having issues send me your views.py file or just a screenshot to dennisivy11@gmail.com and I'll take a look :)
@master-x72833 жыл бұрын
Great tutorial man!
@esequielalbornoz52714 жыл бұрын
Hey there! Really like video! But i suggest everyone not to use allowed_roles=[] (10:30) instead use allowed_roles=None and within the function: if allowed_roles is None: allowed_roles=list()
@esequielalbornoz52714 жыл бұрын
Also, remove the request parameter in the wrapper functions, to make them "usable" also in class base views
@ieanjeremiahgarcia87624 жыл бұрын
Thanks Dennis Ivy I learned a lot from you
@DennisIvy4 жыл бұрын
My pleasure :)
@ieanjeremiahgarcia87624 жыл бұрын
@@DennisIvy Sir I know This is too much but I just want to ask if how can I create an order using the user page I'm having a hard time to come up with some solution so I take a chance to ask you about it, it bothers me for almost a month. I hope you can help me sir and advance Thank you and God Bless you, Sir.
@ShamsSarwari-m8g Жыл бұрын
Thank you. It was really helpful.
@gurnoorsinghdhanju26104 жыл бұрын
Hey dennis i have a query regarding import export model in django admin ....how to export foreign key attributes rather than the number of foreign key
@valentinfontanger49624 жыл бұрын
first thing that comes to my mind : 1) retrieve the instance 2 ) now you have the id, you can just retrieve the instance you want based on this id with : X.objects.get(id=the_id_your_got)
@mdahanaf4 жыл бұрын
Many many Love For Your . I just love your tutorials . Salute you sir and thanks for bearing with us.
@DennisIvy4 жыл бұрын
It'y my privilege :)
@AlbertoAvilaMateos8 ай бұрын
the source code link doesn´t work :( (at least for me)