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:
modified: mainapp/models.py
modified: mainapp/views.py
modified: static/css/style.css
modified: templates/base.html
modified: templates/home.html
modified: 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 context
static/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 inherritance
templates/home.html - added badges for each card.
templates/ngo_volunteer.html - added badges for each card showing volunteer intivudial count and ngo count.
OPTIMIZATIONS.
* Usage of Redis cache to avoid DB hits first hit strike 12 querys to get data.
After caching on first hit, it take none until cache expiry.
Ease Disconnection of changes in this commit from settings.
CONFIGURATIONS.
HOME_PAGE_ANALYTICS = {
'DISPLAY': True,
'INVALIDATION_LOGIC': 'TIMEOUT', # options : ["TIMEOUT", "ON_CREATE"] ## ON_CREATE is accurate but expensive for drastic write COUNT.
'TIMEOUT': 60 * 40, # DEFAULTS TO 40 MINUTE.
'HOME_PAGE_CACHE_KEY': 'home_page_data_statics',
'VOLUNTEER_CACHE_KEY': 'ngo_data_statics',
}
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 in settings.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 .
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;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.
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 .