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-appI used pipenv to create a virtual environment, so you install pipenv globally on your computer:
pip install pipenvCreate a new virtual environment:
pipenv shellNext, install required packages stored in the Pipfile.lock file using the sync command.
pipenv syncThen you enter the app directory
cd django_projectAfter that, you run your migrations:
python manage.py makemigrations
python manage.py migrateFinally, run the app
python manage.py runserverYou're good to go ✨