Building a Simple Book Tracker with Django

The app allows users to:

  • Sign up and log in securely
  • View a list of their books
  • Add new books with details (title, author, and status)
  • Logout and manage their sessions easily

This project will demonstrate basic features of Django, including user authentication, form handling, and dynamic web pages.

Tech Stack:

  • Django: A high-level Python web framework that encourages rapid development and clean, pragmatic design.
  • SQLite: The default database for Django, which stores user data and books.
  • HTML: For structuring the user interface.

Features of the Book Tracker App

  • Users can sign up, log in, and log out. The app uses Django's built-in user authentication system to handle the creation and management of user accounts.
  • Users can view a list of books they've added to the app, which includes the book title, author, and status (e.g., "Read", "Currently Reading", "To Read").
  • Users can add new books by providing details like the title, author, and current status. The form is built using Django's ModelForm, which automatically generates a form based on the model.
  • Users can delete books from their list, which helps in managing their collection effectively.
Project Breakdown
  • Setting Up the Project
    • Install Django and set up the project.
    • Create a new Django app (books) and configure the project settings.
  • User Authentication
    • Django’s built-in authentication system is used to manage user login, logout, and signup functionalities.
    • The login page is protected using the @login_required decorator, ensuring that only logged-in users can access the book tracker.
  • Creating the Book Model
    • Define a Book model with fields for title, author, and status. The status field is a choice field to track whether a book is read, currently reading, or to read.
  • Creating Forms and Views
    • Create a form to add new books using Django's ModelForm.
    • Define views to handle the displaying of books, adding new books, and user authentication.
  • Creating Templates
    • Use Django templates to create a clean and simple interface.
    • Include a navigation bar with links to the homepage, the add book page, and logout functionality.
    • Display the list of books dynamically.
  • Testing the Application
    • Run the development server, sign up, log in, and test adding and viewing books.
    • Ensure that only authenticated users can interact with the book tracker.

You can find all the code here.