A history management app powered by Django. This app uses Djnago's contenttypes framework to manage different types of pages a user views in your application.
The idea behind this application is to show you a how to achieve better polymorphic relationship between objects of different types using GenericForeignKey.
- History - managing different page objects (eg product and blog post object)
- Shopping Cart - managing different types of products (eg ebook, electronics and furniture objects)
Managing these types of relationship using a ForeignKey could be more difficult and there would be need for you to manage your inheritance and migrations when new types of objects are added.
Learn and understand how to build this app. Watch on YouTube
Create a folder on your computer then clone this repo with this command:
git clone https://github.com/fleepgeek/django-history-app.git
#Next
cd django-history-app
I used pipenv to create a virtual environment, so you install pipenv globally on your computer:
pip install pipenv
Create a new virtual environment:
pipenv shell
Next, install required packages stored in the Pipfile.lock
file using the sync
command.
pipenv sync
Then you enter the app directory
cd django_project
After that, you run your migrations:
python manage.py makemigrations
python manage.py migrate
Finally, run the app
python manage.py runserver
You're good to go ✨