AEX03
AEX03
Name: ___________________________________________________________
This exam is closed book, no internet, one page of notes front and back. You can neither give not receive any
assistance to anyone on this exam. The multiple choice questions are five points and the short essay questions
are worth 10 points. There is an extra question so you can miss a question and still get 100%. If you feel a
question is vague or unclear or mistaken, write any assumptions you like about the question and then answer
the question as best as you can. You can put your name on your single page of notes and turn it in with your
exam for grading. Depending on how "good" your notes are, we may award points to cover all or part of any
points you lose on the exam. In no case will your score on this exam be above 100%.
class ArticleListView(ListView):
get_template_names()
render_to_response()
get_queryset()
get_context_data()
3. For the following line in a views.py file
class ArticleListView(ListView):
True False
5. If you want to override the template name chosen by convention in a View that extends
django.views.generic.detail.DetailView what is the name of the class attribute variable that you use?
template
template_extend
template_override
template_name
6. Which of the following Python types is most like the request.POST data in Django?
dictionary
string
tuple
list
7. What built-in Django template filter capitalizes the first character of the value?
toUCFirst
toupper
capfirst
ucfirst
8. What does the built-in Django template tag "url" do?
AutoLoginView
LoginRequiredMixin
AutoRedirectView
MustLoginView
10. By convention when using an app_name of "abc" and a model of "Dog", if you use a View that extends
django.views.generic.list.ListView, what is the name of the context variable that will include all the Dog
objects in the template when it is being rendered?
dogs.values()
dogs_select
dog_list
dogs
11. You are using the following code in your views.py:
There is no get(): method in your class and yet when you send an HTTP GET to the url that is routed to
this view it works fine. Where would you find the definition of the get() method that is being used to
respond to the HTTP GET request?
{% extends 'base_bootstrap.html' %}
How does this line affect the HTML that is generated from this template?
13. In your urls.py file, you see the following line.
What will you see in place of the <int:pk> when looking at an actual URL in the browser when it is
accessing your view?
class MakeView(LoginRequiredMixin,View) :
def get(self, request):
ml = Make.objects.all();
ctx = { 'make_list': ml };
return render(request, 'autos/make_list.html', ctx)
when is the get method called and what does the get method return to its caller?
15. Your application is experiencing a traceback error on the success_url, line in the following code from
your views.py.
What other file in your application should you check to figure out why the reverse_lazy is failing. What
two things should you check in that file?
class MakeView(LoginRequiredMixin,View) :
def get(self, request):
ml = Make.objects.all();
ctx = { 'make_list': ml };
return render(request, 'autos/make_list.html', ctx)