A Django web app for a librarian to manage Authors and Books, and track how many copies of each book are on the shelf.
- Author and Book models, with
Book.authora ForeignKey toAuthor - Full CRUD for both Authors and Books (add / view / edit / delete),
using plain function-based views and manual
request.POST.get(...)handling (noModelForm) - Basic manual validation on create/edit (required fields, ISBN uniqueness, copies must be non-negative whole numbers, copies available can't exceed copies total)
- Borrow / Return buttons on the book detail page
- Borrow:
copies_available -= 1(only if > 0) - Return:
copies_available += 1(capped atcopies_total) is_availableis a@propertyon the model (copies_available > 0), not a stored field
- Borrow:
- Django Admin — both models registered with a custom
list_display - Named URLs everywhere (
{% url 'book-list' %}, etc.) -> no hardcoded links - One
base.htmlwith{% block content %}, extended by every page, plus a sharedincludes/navbar.html
- Search bar on the book list (title or author) and author list (name)
- Filter books by availability
- Pagination on both list pages
library_project/
├── librarysystem/ # settings.py, urls.py (all routes live here)
├── library/ # models.py, views.py, admin.py
│ ├── management/commands/seed_data.py
│ └── migrations/
├── templates/
│ ├── base.html
│ ├── includes/navbar.html
│ └── *.html
├── manage.py
├── requirements.txt
└── README.md
- Clone the repo and move into the project folder:
git clone <your-repo-url> cd library_project
- Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Run migrations:
python manage.py migrate
- (Optional) load sample data:
python manage.py seed_data
- (Optional) create an admin superuser:
python manage.py createsuperuser
- Run the server:
python manage.py runserver
- Visit http://127.0.0.1:8000/ — admin panel at /admin/.





- Python 3 / Django 6.0
- SQLite (default)
- Bootstrap 5 (via CDN)