This is a django project that shelfs books
This shelf can allow admin users perform the following operationns
- Adding new books
- Archiving stolen or lost books
- Delete books
This project was done using Python Programming Language and the Django Web FrameWork
- Start your code editor preferably visual studio code
- Open the folder that contains the bookshelf project after ypu have cloned it
- Intalll the crispy forms library
- Next run
python manage.py migrate
to migrate all models to the database schema - Next run
python manage.py makemigrations
, this will automatically make migrations for all the app present in the project folder - Next run
python manage.py migrate
again to finally move all migrations - Finally you can run the python server using
python manage.py runserver
you can decide to add your desired port number e.gpython manage.py runserver 5000
. This is how we run teh server if we wanted to use port 50000 - Our server should be up and running
- Quit the server by using the keyboard interrupt
CTRL + C
- Run the create superuser command using
python manage.py createsuperuser
- This will prompt us for our details such as username, email address, password and password agai which is to validate our password
Enter Username(hit enter to use the default omputer name)
Email Address
hit enter to leave blankEnter password
andEnter password (again)
- With this few steps our superuser has been created
- Re-run the server again
After we run our Python server running on
port 8000
The default page takes us to the index page which is thebook_list.html
page
-
The booklist page is like this Endpoint
http://127.0.0.1/
- Represents the book list view -
Next we login our superuser Endpoint
http://127.0.0.1:8000/users/login
- Representing the users login page -
After logging in as super user we'll be redirected to the homepage which contains no book, let us add new books, Endpoint
http://127.0.0.1:8000/users/login
Use username=admin and password=admin -
Our add a new book page looks like this Endpoint
http://127.0.0.1:8000/new
back to the list but now we have been authenticated as a superuser
After adding some images we'll have these view
Endpoint http://127.0.0.1:8000/
- for the first page showing only three books
Endpoint http://127.0.0.1:8000/?page=2
- For the second page
Endpoint http://127.0.0.1:8000/?page=3
Note: It can contain as many endpoints we want as long as we continue to add images
-
Checking the details of what we have built looks like this Endpoint
http://127.0.0.1:8000/book/detail/9
- Gives the detail of the 9th book -
Editing the the books have the following look Endpoint
http://127.0.0.1:8000/book/edit/9
- This is the endpoint for editing item 9 -
Archiving the book looks like Endpoint
http://127.0.0.1:8000/book/archive/9
for archiving the 9th object -
Deleting a book looks like Endpoint
http://127.0.0.1:8000/book/delete/3
for deleting teh 3rd Item -
Logging Out looks like Endpoint
http://127.0.0.1:8000/users/logout
to log the user out -
Registering another user whi is not a superuser and viewing the details of each book. Meanwhile for every other view operations is not functional because he/she is not admin
-
Active user sign up i.e means a user that is not a superuser