Django Mastery Quiz

10:00

Forms, authentication, class-based views and the ORM. · 10 questions

Question 1 of 10
Which form method must return `True` before you use `cleaned_data`?
Question 2 of 10
Which decorator redirects anonymous users to the login page?
Question 3 of 10
Which generic view is designed to show a single object?
Question 4 of 10
Which default permission codename does Django create for editing a `Product` in app `shop`?
Question 5 of 10
Why redirect after a successful POST instead of rendering a template?
Question 6 of 10
What is wrong with this view?
class OrderCreate(CreateView, LoginRequiredMixin):
    model = Order
    fields = ['items']
Question 7 of 10
Which call returns a single dictionary like `{'revenue': ...}` for the whole queryset?
Question 8 of 10
Why should `success_url` on a class-based view use `reverse_lazy`?
Question 9 of 10
How many queries does this loop run for 50 orders (no other optimisation)?
for o in Order.objects.all():
    print(len(o.items.all()))
Question 10 of 10
Which statement decrements stock safely even if two requests run at the same moment?