Short overview of Django rest framework & api
- install requirements.txt
pip install -r requirements.txt
- Note that mysql database is used, therefore, after configuring database, populate it with Book objects
APIs to list all books; create, update and delete objects from Book model
initialize the Book model with a serializer
contains functions based views for APIs to
- display overview of API links
- list all objects from Book
- create, update and delete objects from Book
contains Book Model
django source folder containing settings.py
Admin can create, update and delete objects from Book
myAdminForm()
module (Admin Sign Up form):- inherits from django's UserCreationForm
- makes 'email' as a required field
- overrides
save()
method to implement 'admin' status to User
adminLoginForm()
module (Admin Login form):- inherits from django's AuthenticationForm
- sets
username
asEmailField
EmailBackend()
module:- implements
authenticate()
method to authenticate using 'email' instead of django's default authentication using 'username'
- implements
implements function based views for Admin - sign up, login & dashboard
Student can only see all objects from Book
implements similar features as myadmin/forms.py
to a student user
studentSignUpForm()
module (Student Sign Up form):- inherits from django's UserCreationForm
- makes 'email' as a required field
- overrides
save()
method to implement 'admin' status to User
studentLoginForm()
module (Student Login form):- inherits from django's AuthenticationForm
- sets
username
asEmailField
implements function based views for Student - sign up, login & dashboard