Django Features and Libraries | Week 3

Course Name: Django for Everybody

Sub-course: Django Features and Libraries

Course Link: Django for Everybody

Sub-course Link: Django Features and Libraries

These are Django Features and Libraries Week 3 Answers Coursera Quiz


Django Forms

Q1. Which of the following is NOT a benefit of using the Django forms capability?

  • Database portability
  • You can add complex form validation rules to your application
  • You reduce the amount of HTML you need to generate
  • You can have a mapping layer between your models and templates
  • You can easily create attractively styled forms

Answer: Database portability


Q2. What happens when a Create form is submitted and Django forms detects a validation error?

  • The record is deleted form the database
  • The form is re-displayed with the incorrect data
  • The form is re-displayed with the incorrect data and error messages
  • The form is re-displayed with the error messages
  • A 403 (Not authorized) is sent back to the browser

Answer: The form is re-displayed with the incorrect data and error messages


These are Django Features and Libraries Week 3 Answers Coursera Quiz


Q3. You cannot use a Django form unless it is connected to a Django Model.

  • True
  • False

Answer: False


Q4. How do you indicate that you want to display a form using the Crispy library in a template?

  • form.as_table
  • csrf_token
  • form.as_crispy
  • form|crispy

Answer: form|crispy


These are Django Features and Libraries Week 3 Answers Coursera Quiz


Q5. What does the fields=”all” statement do in the Meta section of a Django form class?

  • Indicates that all of the underlying model fields should be in the form
  • Indicates that none of the model fields are to be saved
  • Indicates that the owner field is not supposed to be shown to the user when the form is displayed

Answer: Indicates that all of the underlying model fields should be in the form


Q6. In what method in a view class would you expect to see “form.save()” to save data from an incoming form?

  • post()
  • get()
  • dispatch()
  • get_queryset()

Answer: post()


Q7. What utility method simplifies the code needed to load the old model data when processing an update request?

  • render_to_template_with_check()
  • get_object_or_404()
  • contitional_render_404()
  • load_try_except()

Answer: get_object_or_404()


These are Django Features and Libraries Week 3 Answers Coursera Quiz


More Weeks of this course: Click Here

More Coursera Courses: http://progiez.com/coursera


These are Django Features and Libraries Week 3 Answers Coursera Quiz
The content uploaded on this website is for reference purposes only. Please do it yourself first.