Django Level Three Flashcards
List 3 advantages of using Django’s forms functionality?
- Generate HTML form widgets quickly
- Quicker data validation and processing into a python data structure
- Create form versions of Models, models can be updated from forms.
What are all the necessary tasks (5) for adding a form to your application?
- Create the forms.py file
- Create the forms; similar to models
- Create a view for the form
- Map the view
- Code out the html template
syntax for template tagging?
{{ form }}
what does HTTP stand for?
Hypertext Transfer Protocol
What was HTTP designed for?
communication between a client and a server where the client submits a request and the server responds with what was requested.
What does a GET Request do?
Requests data from a resource
What does a POST request do?
submits data to be processed into a resource
in the template tag {{ form.as_p }} what is the .as_p for?
formats the form to look nicer
what do you need to place under your forms template tag in order for it to work?
{% csrf_token %}
what does csrf_token stand for?
cross site request forgery token
what does the csrf_token do in a nutshell?
verifies data
make sure it gets to where it’s going
How does a csrf_token work?
checks to see that “hidden input” code matches
A form class inherits from …
forms.Form in the same way that a model class inherits from models.Model
in a form class, field classes are accessed from what module?
the forms module
What arg can you add into the CharFIeld() class to format how it looks?
widget=forms.Textarea