Fix #1030. Display volunteer count on home page #1036
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
COMMIT ensures there is no breaking in design or working of the application.
CHANGES
Date: Sat Aug 10 12:47:58 2019 +0530
On branch 2019/jerinisready/issue_fix
Changes to be committed:
mainapp/models.py
mainapp/views.py
static/css/style.css
templates/base.html
templates/home.html
templates/ngo_volunteer.html
Issue Reference
This PR addresses the Issue: Fixes #1030
Summarize
Added badges to cards which shows count of active items in that section.
Updations
mainapp/models.py
- added classmethods for models to get count with neet filtering where required.mainapp/views.py
- caching and passing required counts as contextstatic/css/style.css
- reformated style as per standards with auto intent in Pycharm;- added styles for badge in card
- added a fair border for from.
templates/home.html
- added{% block title %}
to provide title inherritancetemplates/home.html
- added badges for each card.templates/ngo_volunteer.html
- added badges for each card showing volunteer intivudial count and ngo count.OPTIMIZATIONS.
After caching on first hit, it take none until cache expiry.
* Ease Disconnection of changes in this commit from settings.
CONFIGURATIONS.
while coding reviews
settings.HOME_PAGE_ANALYTICS['DISPLAY'] = True
will enable the changes which makes the changes shown as in the images. Turning it off will make everything working normal.settings.HOME_PAGE_ANALYTICS['INVALIDATION_LOGIC'] = 'TIMEOUT'
will invalidate cache insettings.HOME_PAGE_ANALYTICS['TIMEOUT']
seconds which is default to 40 minutes.settings.HOME_PAGE_ANALYTICS['INVALIDATION_LOGIC'] = 'ON_CREATE'
will be eager mode which invalidates cache to get most up to date result, which invalidates cache on every creation in specific tables.settings.HOME_PAGE_ANALYTICS['HOME_PAGE_CACHE_KEY'] = 'home_page_data_statics'
makes redis key to store values for home page counts .settings.HOME_PAGE_ANALYTICS['VOLUNTEER_CACHE_KEY'] = 'ngo_data_statics'
makes redis key to store values for volunteer data counts .