Upwork Test Answers: Get all the correct answers of most recent and possible Upwork Tests A to Z (Updated on Jan, 2016)
Cover Letter Templates: These cover letter samples are not only for Upwork job, but also you will have some idea about your real life job
Freelance Profile Overviews: Different Profile samples and overviews of experts, advanced and intermediate level freelancers
For Newbie of Upwork: Upwork Help - How to apply for a job in Upwork with 10 most important articles about Upwork

A to Z View - All Upwork Test Answers

Django Test Answers (new)

Django Test is Web development category test of Upwork. Django is a free and open source web application framework, written in Python, which follows the model–view–controller architectural pattern. In this post, you will have most recent Upwork test questions and correct answers of Django Test.

You can search your desired answers of the Upwork Django Test by pressing Ctrl + F button.

1. Consider the following Python string representing a human readable date and time:
 dt = 'Jan 14 2009 11:00PM'

 Which of the following code snippets will convert the above string to a Python Datetime object that is suitable for a django.models.DateField?
 Answers: • date_object = datetime.strptime(dt, '%b %d %Y %I:%M%p')

 2. Which of the following is false about the django.models.SlugField() model field?
 Answers: • It is used when performing a query, or as a part of a URL, since by default it ensures uniqueness.

 3. What does the django.core.context_processors.static() method do?
 Answers: • It adds STATIC_URL to every template context rendered with RequestContext contexts.

 4. Which of the following statements is true about the django.template.RequestContext class?
 Answers: • It takes an HttpRequest as its first argument.

 5. Consider two Django QuerySets query_set_1 and query_set_2 from two different models.
 Which of the following code snippets is the most performant when concatenating the two QuerySets into one list?
 Answers: • from itertools import chain result_list = list(chain(query_set_1,query_set_2))

 6. Which of the following statements about database transactions in Django is false?
 Answers: • "atomic" blocks cannot be nested.

 7. Consider the following code snippet for a Django Model:

 class Salary(models.Model):
 amount = models.PositiveIntergerField(help_text='eg 8000')
 retired = models.BooleanField(help_text='True if above average')

 Which of the following will correctly produce a QuerySet of all Salary objects where retired == True and amount != 7300?
 Answers: • from django.db.models import Q results = Salary.filter(~Q(amount=7300),retired=True)

 8. Which of the following gets called when a view raises an exception?
 Answers: • process_exception()

 9. What is the best way to extend the Django user model with extra custom fields in addition to the fields already provided?
 Answers: • Use a one-to-one relationship to a model containing the extra fields.

 10. Which of the following statements are true about the ImageField class?
 Answers: • It inherits all attributes and methods from the FileField class.

 11. What does the "with" template tag do?
 Answers: • It caches a complex under a simpler name.

 12. Which of the following statement is false about the django.http.HttpRequest.get_host() method ?
 Answers: • This method is invoked if some code accesses the Host header from request.META, thus providing a security measure to prevent an attacker from poisoning caches and password reset emails with links to malicious hosts by submitting requests with a fake HTTP Host header.

 13. What is the default max_length value of a SlugField class in Django?
 Answers: • 50

 14. Which of the following is a built-in BaseCommand subclass?
 Answers: • AppCommand

 15. Which of the following statements is true about Django's default implementation of the authentication system?
 Answers: • django.contrib.auth will ensure that add, change and delete permissions are created for each Django model defined in an installed application.

 16. Which of the following happens when process_exception() returns "None"?
 Answers: • The default exception handling will be applied.

 17. Which of the following is not a predefined log level in Django?
 Answers: • FATAL

 18. Which of the following classes uses an HTTP 304 status code?
 Answers: • HttpResponseNotModified

 19. Which of the following django.template.loader functions will take a list of template names and return the first template that exists?
 Answers: • select_template

 20. Which of the following is not a built-in Django template loader class?
 Answers: • file.Loader