Django Level Five Flashcards
which password hashers did we install?
argon2: pip install django[argon2]
bcrypt: pip install bcrypt
to use a password hasher, it must be added to the ____ in settings.py
PASSWORDS_HASHERS list
syntax for adding an option to a password validator
What is the difference between static files and media files?
content that you provide (static) versus content that your user provides (media)
code for setting up static and media directories.
what library must be installed in order to work with images?
the python imaging library:
pip install pillow
always remember to register models that you want admin control over to the ___
admin.py file
Broad steps for creating a UserProfileInfo() model
- import models and User
- define the class
- instatiate the user field which uses the imported User model as its base by way of the .OneToOneField() method
- add additional fields to the UserProfileInfo model
- def a string representation of the model
what does the on_delete=models.cascade mean as an argument in a OneToOneField() or ForeignKey()?
When the referenced model is deleted, also delete other model instances that referenced it.
what does the blank=true mean as an argument in a FieldClass?
Information for that field can remain blank
When using an ImageField() class, how does it know where the file should be stored?
add the kwarg: upload_to=’profile_pics’
List the broad steps for creating a Form class in forms.py
1. import forms, User, and UserProfileInfo from their respective sources
- define the class
- add any fields that are not already present in the model that we are creating a form for (this step can be skipped).
- define a class Meta() with model equal to the mode we are basing the form off of, and the fields from that model (and the form class) that we want to add to the form.
what is the code for adding a password input widget to a Form class?
what are the heirarchy of tags when creating a navbar?
- nav
- div
- ul
- li
- li
- li
- ul
- div
how do you change how each button in a navbar looks?