A compact Django project built to keep track of a world currency (money) collection for my son.
Table of Contents
My oldest son has recently acquired an interest in money from around the world and started building a collection. When it got beyond a collection of 30 different coins in various langauges, it became difficult for us to keep track of which coins came from where. So I built this compact project for my son to keep track of what currency he already has and what countries he still needs for his collection.
On the home page, you can see a visual representation of the countries already in your collection as well as a table that displays a listing of the countries that you are missing from your collection.
Below are instructions for setting up this project on your local machine. The shell commands below are written with Linux Ubuntu in mind. If you are using a different operating system, your instructions may vary.
- Python 3.6+
- Python 3.6+ virtual environment
sudo apt install python3-venv
-
Clone the repo
git clone https://github.com/kaido1224/currencytracker.git
-
Navigate to the project directory created.
cd currencytracker
-
Setup Python virtual environment
python3 -m venv ve
-
Activate the new virtual environment
. ve/bin/activate
-
Update pip
pip install -U pip
-
Install the requirements file
pip install -r requirements.txt
-
If you didn't already have Postgres installed, follow the instructions below to set it up.
sudo -u postgres createuser --superuser --createdb --pwprompt usernamehere
-
Create a database for CurrencyTracker in Postgres, assign it to your user.
psql create database currency with owner usernamehere; \q
-
Create a secrets.py file under settings.
sudo vim currency/settings/secrets.py
Inside of the file, create a secrets dictionary similar to the below:
secrets_dict = { "SECRET_KEY": "DJANGOSECRETKEYHERE", "DB_USER": "YOURPOSTGRESUSERHERE", "DB_PASSWORD": "YOURPOSTGRESUSERPWHERE" }
After that, save and exit.
-
Apply database migrations. If you want prepopulated data, access myapp.0002_auto_20211210_0311.py under myapp/migrations and uncomment out the book creation and currency bulk_create sections.
./manage.py migrate
-
Create a superuser to log into the project.
./manage.py createsuperuser
-
If done correctly, you should now be able to run CurrencyTracker in a development environment.
./manage.py runserver
-
In your browser, navigate to http://127.0.0.1:8000, you should see a login screen. Use the credentials you created in step 11 to login.
This project currently has three main pages. The first, is the home page already discussed above. The other two pages, book management and collection management, both contain similar sub pages and can be accessed in the left-hand navigation menu. A more detailed explanation of these two management pages, and their underlying models is described below.
Before you create entries into your collection, you must first create a book that you can assign your collection entries to. On the book management page you can view your existing collection books, add a new one, edit existing book details or delete books and their associated collections.
Below is a brief description of the fields associated to a book.
Field | Value | Description | Required? |
---|---|---|---|
Description | String, up to 100 characters | You can enter the title of the book here. Otherwise, if you are like my son, whose collection books don't have a title, enter a description of the book instead. | Yes |
Pages | Integer | The number of pages in the book. At this time, this isn't used for anything. | No |
Rows Per Page | Integer | The number of rows on a given page. At this time, this isn't used for anything. | No |
Columns Per Row | Integer | The number of columns on a given row on a page. At this time, this isn't used for anything. | No |
Once you've created a book for your collection, you can begin using the collection management page. On this page, similar to the book management page, you can view your existing collection entries, add a new one, or edit or delete existing entries.
Below is a brief description of the fields associated to a collection entry. Most of the fields are not required to allow you to fill in the information that you know now and can fill in the rest of the information later.
Field | Value | Description | Required? |
---|---|---|---|
Book | Book ID | The book the collection entry is located in. | Yes |
Page | Integer | The page in the book the entry is located in. | No |
Row | Integer | The row on the page the entry is located in. | No |
Column | Integer | The column in the row the entry is located in. | No |
Currency | String, up to 100 characters | The name of the currency, such as a Euro Cent or Peso. | No |
Value | Decimal | The value of the currency. | No |
Type | String, 4 characters. | What type of currency this is. Should be either a bill or coin. | No |
Country | String, 2 character ISO code for the country. | The country that this currency came from. | No |
There are certain countries that share a currency with several others and are grouped together as a different country entry. These special exceptions are shown below.
Country Name | Affiliated Countries |
---|---|
Central Africa CFA | Cameroon, Central African Republic, Chad, Equatorial Guinea, Gabon, Republic of the Congo |
Eastern Carribean Islands | Anguilla, Antigua and Barbuda, Dominica, Grenada, Montserrat, Saint Kitts and Nevis, Saint Lucia, Saint Vincent and the Grenadines |
West Africa CFA | Benin, Burkina Faso, Côte d'Ivoire, Guinea-Bissau, Mali, Niger, Senegal, Togo |