Django ORM is awesome and this challenge will help you to understand why
The challenge is to implement database queries as required in tests.py
so all tests will pass
There are 10 tests that based on covid19 app which define database models and relations
Django 1.11
pip install -r requirements.txt
python manage.py migrate --settings=django_advanced_queries.settings
Sources of information:
- https://levelup.gitconnected.com/demystifying-complex-queries-for-django-orm-2297d3bfbd2f
- https://docs.djangoproject.com/en/1.11/ref/models/querysets/
- https://docs.djangoproject.com/en/1.11/ref/models/conditional-expressions/
- https://docs.djangoproject.com/en/1.11/ref/models/expressions/
Running Tests
export PYTHONPATH=path/to/django_advance_queries
export DJANGO_SETTINGS_MODULE=django_advanced_queries.settings
python manage.py test
- Avoid searching the internet and use the sources
- Some tests may require a change of the test result itself in order to meet the requirement for a specific number of queries
- After you successfully finish the challenge create new test that requires function which was not used in any of the previous tests and send to me
- If you are having troubbles feel free contact me for questions
- You can ask for hints