Web app to test case Managers for models in Django. The App consists in listing on html page (http://localhost:8000/author-list/) all the Authors with the sum of copies sold of all their books.
Test case allows the user to visit website to view a list of all authors and their amount of books sold per author.
It is partly tested as only and was developed as showcase only.
How Django Models Managers Works:
- You can open the browser with the url http://localhost:8000/author-list to view the list of authors and all book's copies sold.
- You can open the browser with the url http://localhost:8000/author-list-complex to view the list of authors and all book's copies sold and number of books and only the authors who have sold more than 100 books.
-
- Installing Django Models Managers App
- Instructions to test with django-debug-toolbar
-
- Available Endpoints
- Tests INFO
- Clone repository and go inside the repository folder "django-model-managers"
git clone https://github.com/Fantaso/django-model-managers.git
- Create your virtualenv and install the packages
pip install -r requirements.txt
- Migrate the database.
python manage.py makemigrations && python manage.py migrate
- Run the application.
python manage.py runserver
- Create a superuser in order to access the Django Admin app and follow the instructions
python manage.py createsuperuser
-
Go to http://localhost:8000/admin and login with your username and password created in the previous step
-
Once in the Admin app, add as many Authors and Books to your database.
-
Once you have added all authors and books go to the endpoints available and you should see a webpage with a list of all Authors and Book information rendered with the django Debug Toolbar on the side. Just click the logo "DjDT" on the right side of the website and check it.
URI Example: http://localhost:8000/author-list
URI Example: http://localhost:8000/author-list-complex
A small TestCase was done to check the manager annotate_with_copies_sold query method since, to tested over the webapp template at eh endpoint of 'author-list/' or 'author-list-complex/' will need extra requirements like migrating, creating a superuser and adding on the admin panel new Authors and Books to the local database
- Run the Django Models Managers app tests locally with:
python manage.py test
Technology Stack | ||
---|---|---|
Python | Back-End | |
Django | Web Framework | |
Django Debug toolbar | Browser Debug Tool |
Get in touch -–> Github