I initially developed this mini project in order to explore and investigate what it is like to develop whilst leaning heavily on agentic AI tooling. This work was done mostly with Devin session and batch modes. Although this application works and has more features than I would be able to produce manually in the same timeframe, I remain skeptical of the efficacy of producing large bodies of development work. In particular, the readability and composition of this application started to get out of hand - I am learning though, and I can see the power of such tooling. I think if one slowed just a little bit, planned properly and made use of PR reviewing tools then there is certainly potential for a lone developer to achieve quite a lot. Overall I'm fairly impressed, a little concerned and mildy baffled. I may come back and try a refactor at some point, either manually or with an agent. With that being said, have a nice day and continue...
A Django web application for managing sales and purchases records for a small business. Import data via CSV, filter and browse records, generate PDF reports, and track profitability — all through a simple web interface backed by PostgreSQL.
- Configurable CSV import — define format profiles with custom delimiters, date formats, and column mappings to import CSVs from any source
- Dashboard — view total sales, total purchases, and net profit across a configurable date range
- Filtering & sorting — filter by date, item name, price range, post code, source, and notes; sort by any column
- PDF reports — export sales, purchases, or a combined business report as a PDF; reports respect active filters and date ranges
- Report presets — save named presets (e.g. "This Month – Sales") and run them in one click
- CSV & database export — export records as CSV or take a full PostgreSQL dump for backup and restore
- Notes — add inline notes to individual records; browse all notes from a dedicated page
- Sources — tag records with a named source for grouping and filtering
- Docker and Docker Compose installed
-
Create a new
.envfile using.env.exampleas a template -
Start the application:
docker compose up --build
-
In a separate terminal, create a superuser:
docker compose exec web python manage.py createsuperuserMigrations run automatically on startup.
-
Access the application:
- Dashboard: http://localhost:8000/
- Django Admin: http://localhost:8000/admin/
CSV imports are managed through the Django Admin:
- Log in at http://localhost:8000/admin/
- Create a CSV Format Profile under Records > CSV Format Profiles, specifying the delimiter, date format, and a mapping of column index to field name
- Navigate to CSV Uploads > Add CSV Upload, select the record type, choose the format profile, and upload the file
- The system validates, deduplicates (by UUID), and imports the records
Sample CSV files are provided in the sample_data/ directory.
| URL | Description |
|---|---|
/ |
Dashboard — summary and date-range filter |
/sales/ |
Sales records — filter, sort, paginate, export |
/purchases/ |
Purchase records — filter, sort, paginate, export |
/notes/ |
All annotated records |
/reports/ |
Saved report presets |
/admin/ |
Django admin — import, manage records, export data |
Requires Python 3.x. Uses SQLite instead of PostgreSQL.
pip install -r requirements.txt
python manage.py migrate --settings=config.settings_local
python manage.py createsuperuser --settings=config.settings_local
python manage.py runserver --settings=config.settings_localThe application will be available at http://localhost:8000/.
# Via Docker
docker compose exec web python manage.py test
# Locally (uses in-memory SQLite)
python manage.py test --settings=config.settings_testdjango-client/
├── config/ # Django project configuration
│ ├── settings.py # Production settings (PostgreSQL)
│ ├── settings_local.py # Local dev settings (SQLite)
│ ├── settings_test.py # Test settings (in-memory SQLite)
│ ├── urls.py # Root URL configuration
│ └── wsgi.py # WSGI entry point
├── apps/
│ └── records/ # Main application
│ ├── models.py # SalesRecord, PurchaseRecord, CSVUpload, CSVFormatProfile, ReportPreset, Source
│ ├── admin.py # Admin: CSV upload processing, format profiles, DB export
│ ├── forms.py # CSVUploadForm, CSVFormatProfileForm
│ ├── views.py # Dashboard, detail, notes, presets, PDF and CSV export
│ ├── urls.py # App URL routes
│ ├── services/
│ │ ├── csv_parser.py # Profile-driven CSV parsing
│ │ ├── aggregation.py # Filtering, sorting, totals
│ │ ├── export_service.py # CSV and PostgreSQL dump export
│ │ └── presets.py # Time-window resolution for report presets
│ ├── templatetags/ # Custom template tags
│ ├── templates/ # App-specific templates
│ └── tests/ # Automated tests
├── templates/ # Base templates
├── static/css/ # Stylesheets
├── sample_data/ # Example CSV files
├── Dockerfile # Container definition
├── docker-compose.yml # Multi-service orchestration
└── manage.py # Django management script
Requires Docker. The dump must have been created using the DB Dump export in the Admin.
# Start the database only
docker compose up -d db
# Drop the database
docker compose exec db dropdb -U postgres --if-exists django_client
# Create new database
docker compose exec db createdb -U postgres django_client
# Restore the dump
cat db_dump_YYYY-MM-DD.sql | docker compose exec -T db psql -U postgres -d django_client
# Start the web service
docker compose up webThe dump includes all Django tables, so migrations are not required after restore. Create a new superuser if the original is not included in the dump.
- The root
README.md(/README.md) currently describes an entirely unrelated blockchain data platform and should be replaced or removed — it will mislead anyone landing on the repository. - PDF generation uses WeasyPrint and only activates when
DEBUG=False(i.e. inside Docker). In local dev mode it renders as HTML instead.
openssl req -x509 -nodes -days 3650 -newkey rsa:2048
-keyout nginx/certs/selfsigned.key
-out nginx/certs/selfsigned.crt
-subj "/CN=soul-trader.local"
-addext "subjectAltName=IP:192.168.1.x,DNS:soul-trader.local"