From 034361124f5c02cab2fda68dacc9519412281f98 Mon Sep 17 00:00:00 2001 From: JK Date: Sat, 10 Aug 2019 12:47:58 +0530 Subject: [PATCH 1/4] Added Count of Registrations in each section over home page. COMMIT ensures there is no breaking in design or working of the application. CHANGES ======= Added badges to cards which shows count of active items in that section. 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 --- mainapp/models.py | 63 ++++++++++++++++++++++++--- mainapp/views.py | 31 +++++++++++-- static/css/style.css | 83 ++++++++++++++++++++--------------- templates/base.html | 5 ++- templates/home.html | 84 +++++++++++++++++++++++++----------- templates/ngo_volunteer.html | 3 ++ 6 files changed, 199 insertions(+), 70 deletions(-) diff --git a/mainapp/models.py b/mainapp/models.py index 759e6eedb..da016306f 100644 --- a/mainapp/models.py +++ b/mainapp/models.py @@ -8,6 +8,7 @@ from django.db import models from django.core.validators import RegexValidator from django.contrib.auth.models import User +from django.db.models import Q from django.urls import reverse from django.core.exceptions import ValidationError from django.db.models.signals import post_save @@ -15,7 +16,7 @@ from django.core.cache import cache from django.dispatch import receiver from django.utils import timezone - +from django.utils.functional import cached_property districts = ( ('alp','Alappuzha - ആലപ്പുഴ'), @@ -189,6 +190,15 @@ def __str__(self): def is_old(self): return self.dateadded < (timezone.now() - timezone.timedelta(days=2)) + @classmethod + def request_for_rescue(cls): + return cls._default_manager.filter(needrescue=True).count() + + @classmethod + def request_for_resource(cls): + flt = Q(needwater=True) | Q(needfood=True) | Q(needcloth=True) | Q(needcloth=True) | Q(needmed=True) | Q(needtoilet=True) | Q(needkit_util=True) + return cls._default_manager.filter(flt).distinct('id').count() + class Volunteer(models.Model): district = models.CharField( @@ -220,6 +230,10 @@ class Meta: def __str__(self): return self.name + @classmethod + def count(cls): + return cls._default_manager.count() + class NGO(models.Model): district = models.CharField( @@ -251,6 +265,10 @@ class Meta: def __str__(self): return self.name + @classmethod + def count(cls): + return cls._default_manager.count() + class Contributor(models.Model): district = models.CharField( @@ -283,6 +301,10 @@ class Meta: def __str__(self): return self.name + ' ' + self.get_district_display() + @classmethod + def count(cls): + return cls._default_manager.count() + class DistrictManager(models.Model): district = models.CharField( @@ -301,6 +323,10 @@ class Meta: def __str__(self): return self.name + ' ' + self.get_district_display() + @classmethod + def count(cls): + return cls._default_manager.count() + class DistrictNeed(models.Model): district = models.CharField( @@ -308,7 +334,7 @@ class DistrictNeed(models.Model): choices = districts, ) needs = models.TextField(verbose_name="Items required") - cnandpts = models.TextField(verbose_name="Contacts and collection points") #contacts and collection points + cnandpts = models.TextField(verbose_name="Contacts and collection points") #contacts and collection points class Meta: verbose_name = 'District: Need' @@ -317,6 +343,10 @@ class Meta: def __str__(self): return self.get_district_display() + @classmethod + def count(cls): + return cls._default_manager.count() + class DistrictCollection(models.Model): district = models.CharField( @@ -394,10 +424,13 @@ def district_name(self): 'wnd':'Wayanad - വയനാട്', }.get(self.district, 'Unknown') - def __str__(self): return self.name + @classmethod + def count(cls): + return cls._default_manager.filter(status="active").count() + @receiver(post_save, sender=RescueCamp) def expire_people_filter_form(sender, **kwargs): @@ -445,10 +478,14 @@ class Meta: verbose_name = 'Private Relief: Camp' verbose_name_plural = "Private Relief: Camps" - def __str__(self): return self.name + @classmethod + def count(cls): + return cls._default_manager.filter(status="active").count() + + class Person(models.Model): name = models.CharField(max_length=51,blank=False,null=False,verbose_name="Name - പേര്") @@ -533,6 +570,10 @@ def save(self, *args, **kwargs): if(Person.objects.filter(unique_identifier = self.unique_identifier).count() == 0 ): super(Person, self).save(*args, **kwargs) + @classmethod + def count(cls): + return cls._default_manager.count() + def upload_to(instance, filename): @@ -562,6 +603,11 @@ def __str__(self): return self.description[:100] + @classmethod + def count(cls): + return cls._default_manager.count() + + class DataCollection(models.Model): created_at = models.DateTimeField(auto_now_add=True) document_name = models.CharField( @@ -641,6 +687,10 @@ def __str__(self): def get_absolute_url(self): return reverse('collection_centers_list') + @classmethod + def count(cls): + return cls._default_manager.count() + class CsvBulkUpload(models.Model): name = models.CharField(max_length=20) @@ -686,4 +736,7 @@ class Hospital(models.Model): def __str__(self): return self.name + ' - ' + self.designation - \ No newline at end of file + + @classmethod + def count(cls): + return cls._default_manager.count() diff --git a/mainapp/views.py b/mainapp/views.py index 227ef4187..c52cce8f9 100644 --- a/mainapp/views.py +++ b/mainapp/views.py @@ -202,10 +202,33 @@ class RegisterContributor(CreateView): class HomePageView(TemplateView): template_name = "home.html" + def get_context_data(self, **kwargs): + cxt = super(HomePageView, self).get_context_data(**kwargs) + cxt['request_for_rescue_count'] = Request.request_for_rescue() + cxt['request_for_resource_count'] = Request.request_for_resource() + cxt['relief_camps_count'] = RescueCamp.count() + cxt['announcement_count'] = Announcements.count() + cxt['to_contribute_count'] = Contributor.count() + cxt['district_needs_count'] = DistrictNeed.count() + cxt['volunteer_and_ngo_company_count'] = Volunteer.count() + NGO.count() + cxt['contact_info'] = DistrictManager.count() + cxt['registered_requests_count'] = "-" # todo + + cxt['hospital_count'] = Hospital.count() + cxt['private_relief_and_collection_centers_count'] = PrivateRescueCamp.count() + CollectionCenter.count() + + return cxt + class NgoVolunteerView(TemplateView): template_name = "ngo_volunteer.html" + def get_context_data(self, **kwargs): + cxt = super(NgoVolunteerView, self).get_context_data(**kwargs) + cxt['registered_volunteers_count'] = 0 + cxt['registered_ngo_count'] = 0 + return cxt + class MapView(TemplateView): template_name = "mapview.html" @@ -259,7 +282,8 @@ def __init__(self, *args, **kwargs): def relief_camps(request): - return render(request,"mainapp/relief_camps.html") + context = {'count': RescueCamp.count(), } + return render(request,"mainapp/relief_camps.html", context=context) def missing_persons(request): @@ -272,7 +296,7 @@ def relief_camps_list(request): paginator = Paginator(relief_camps,50) page = request.GET.get('page') data = paginator.get_page(page) - return render(request, 'mainapp/relief_camps_list.html', {'filter': filter, 'data': data}) + return render(request, 'mainapp/relief_camps_list.html', {'filter': filter, 'data': data, 'count': paginator.count}) class RequestFilter(django_filters.FilterSet): class Meta: @@ -831,13 +855,14 @@ def dispatch(self, request, *args, **kwargs): class ConsentSuccess(TemplateView): template_name = "mainapp/volunteer_consent_success.html" + def camp_requirements_list(request): filter = CampRequirementsFilter(request.GET, queryset=RescueCamp.objects.all()) camp_data = filter.qs.order_by('name') paginator = Paginator(camp_data, 50) page = request.GET.get('page') data = paginator.get_page(page) - return render(request, "mainapp/camp_requirements_list.html", {'filter': filter , 'data' : data}) + return render(request, "mainapp/camp_requirements_list.html", {'filter': filter , 'data': data}) class RequestUpdateView(CreateView): diff --git a/static/css/style.css b/static/css/style.css index fceed6a5d..7bbaa501f 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -83,6 +83,9 @@ form{ width:96%; margin: 20px auto; max-width: 600px; + border: 2px solid #fff; + padding: 14px; + border-radius: 10px; } footer{ margin: 40px 0; @@ -183,7 +186,7 @@ tr:hover td{ .pagination a:hover:not(.active) {background-color: #ddd;} table thead tr th { - border-top: 2px solid #ddd !important; + border-top: 2px solid #ddd !important; } .container{ @@ -203,13 +206,13 @@ table thead tr th { font-size: 12px; color:#777777; } - .priority-index b{ - display: inline-block; - width:14px; - height: 4px; - border-radius: 2px; - margin: 0 2px 2.5px 10px; - } +.priority-index b{ + display: inline-block; + width:14px; + height: 4px; + border-radius: 2px; + margin: 0 2px 2.5px 10px; +} .card{ display: block; background: #FFFFFF; @@ -229,18 +232,18 @@ table thead tr th { font-size: 14px; margin-bottom:6px; } - .card-link{ - margin: 12px 5px; - } +.card-link{ + margin: 12px 5px; +} .card-time{ float: left; color: #888888; font-size: 12px; padding:2px 8px; } - .card-time .glyphicon{ - font-size: 80%; - } +.card-time .glyphicon{ + font-size: 80%; +} .card-priority{ float: left; color: #FFFFFF; @@ -264,33 +267,33 @@ table thead tr th { /* Card Priority Variation */ .card.priority-very-important{ - border-top:5px solid #e05959; - border-left: none; - margin-bottom: 40px; - box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12); - } - .card.priority-very-important .card-text{ - font-size: 16px; - } - .card.priority-very-important .card-priority{ - font-size: 14px; - padding: 4px 12px; - background-color:#e05959; - -webkit-animation: 1s pinned-message-priority infinite; - animation: 1s pinned-message-priority infinite; - } - .card.priority-very-important .card-time{ - float: right - } + border-top:5px solid #e05959; + border-left: none; + margin-bottom: 40px; + box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12); +} +.card.priority-very-important .card-text{ + font-size: 16px; +} +.card.priority-very-important .card-priority{ + font-size: 14px; + padding: 4px 12px; + background-color:#e05959; + -webkit-animation: 1s pinned-message-priority infinite; + animation: 1s pinned-message-priority infinite; +} +.card.priority-very-important .card-time{ + float: right +} .card.priority-high{border-color:#ef7831;} - .card.priority-high .card-priority{background-color:#ef7831;} +.card.priority-high .card-priority{background-color:#ef7831;} .card.priority-medium{border-color:#ffc107;} - .card.priority-medium .card-priority{background-color:#ffc107;} +.card.priority-medium .card-priority{background-color:#ffc107;} .card.priority-low{border-color:#286090;} - .card.priority-low .card-priority{background-color:#286090;} +.card.priority-low .card-priority{background-color:#286090;} /* Safari 4.0 - 8.0 */ @-webkit-keyframes pinned-message-priority { @@ -318,3 +321,13 @@ table thead tr th { margin-right: auto; max-width: 1170px; } + +.badge { + margin-top:10px; + padding: 5px 7px; +} +.badge.badge-info { + color: #fff; + background-color: #9e9e9e; + border-color: #1b6d85; +} diff --git a/templates/base.html b/templates/base.html index f15477ef6..01079a951 100644 --- a/templates/base.html +++ b/templates/base.html @@ -102,10 +102,13 @@ {% block javascript %} {% endblock %} - diff --git a/templates/home.html b/templates/home.html index 07faba038..8740d1823 100644 --- a/templates/home.html +++ b/templates/home.html @@ -3,34 +3,40 @@ {% block content %} {% load bootstrap3 %} - + + +

Keralarescue

An initiative by Govt. of Kerala, Kerala State IT Mission and IEEE Kerala Section
- For effective collaboration and communications between authorities, volunteers and public

+ For effective collaboration and communications between authorities, volunteers and public
ദുരിതാശ്വാസ പ്രവർത്തനങ്ങളും രക്ഷാ ദൗത്യങ്ങളും ഏകോപിപ്പിക്കാൻ
- - Donate to Chief Minister's Fund Online -

- - {% bootstrap_icon "bell" %} - + + Donate to Chief Minister's Fund Online +

+ + {% bootstrap_icon "bell" %} + Request
for rescue
രക്ഷാപ്രവർത്തനം അഭ്യർത്ഥിക്കാൻ
-
- {% bootstrap_icon "grain" %} - + Registered: {{ request_for_rescue_count}} + + + {% bootstrap_icon "grain" %} + Request
for resources
സഹായം അഭ്യർത്ഥിക്കാൻ
-
+ Registered: {{ request_for_resource_count}} + + {% bootstrap_icon "phone" %} @@ -86,13 +98,15 @@

Keralarescue

INFO
ഞങ്ങളുമായി ബന്ധപ്പെടാൻ + Registered: {{contact_info}}
- {% bootstrap_icon "list" %} - + {% bootstrap_icon "list" %} + Registered Requests
ഇതു വരെ ആവശ്യപ്പെട്ടവ
+ Registered: {{registered_requests_count}}
{% bootstrap_icon "plus" %} @@ -100,6 +114,7 @@

Keralarescue

ആശുപത്രികൾ + Registered: {{hospital_count}}
{% bootstrap_icon "briefcase" %} @@ -107,16 +122,33 @@

Keralarescue

Collection Centers
സ്വകാര്യ റിലീഫ് ആൻഡ് കളക്ഷൻ സെന്ററുകൾ + Registered: {{private_relief_and_collection_centers_count}}

- For emergency support, call the District control room at 1077 or the State control room at 1070.
+ For emergency support, call the District control room at 1077 or the State control room at 1070.
Volunteers may contact District Project Managers for support related to volunteering and contributions

സഹായത്തിനായി സന്നദ്ധ സേവകർ തയ്യാറാണ്.
സഹായം ആവശ്യമെങ്കിൽ വിളിക്കുക: ജില്ലാ കൺട്രോൾ റൂം: 1077 , സംസ്ഥാന കൺട്രോൾ റൂം: 1070

-
-

- Our Collaboration Platform (Slack) Join -

+
+

+ Our Collaboration Platform (Slack) Join +

{% endblock %} +{% block javascript %} + +{% endblock %} \ No newline at end of file diff --git a/templates/ngo_volunteer.html b/templates/ngo_volunteer.html index 65fa3594d..f760e2fee 100644 --- a/templates/ngo_volunteer.html +++ b/templates/ngo_volunteer.html @@ -33,6 +33,8 @@

keralarescue

Volunteers + Registered: {{ registered_volunteers_count }} + {% bootstrap_icon "list-alt" %} @@ -47,6 +49,7 @@

keralarescue

NGO's/Company's + Registered: {{ registered_ngo_count }}

Contact Control Room or Disaster Management Cell or District Administration for any support.
From bdf525b4daef7be7e01838caf5c10f9b19dfa45a Mon Sep 17 00:00:00 2001 From: JK Date: Sat, 10 Aug 2019 15:45:26 +0530 Subject: [PATCH 2/4] Settings Optimizations --- floodrelief/settings.py | 11 +++++++- mainapp/models.py | 29 +++++++++++++++++++ mainapp/views.py | 55 +++++++++++++++++++++++++----------- templates/base.html | 2 +- templates/home.html | 29 ++++++++++++++++++- templates/ngo_volunteer.html | 8 ++++++ 6 files changed, 115 insertions(+), 19 deletions(-) diff --git a/floodrelief/settings.py b/floodrelief/settings.py index 4695a010b..4e8d9d0d3 100644 --- a/floodrelief/settings.py +++ b/floodrelief/settings.py @@ -229,7 +229,7 @@ def get_list(text): S3_URL = "https://{}.s3.ap-south-1.amazonaws.com".format(bucket_name,) -if os.environ.get('USE_S3','').lower() == "true" : +if os.environ.get('USE_S3','').lower() == "true": AWS_STORAGE_BUCKET_NAME=bucket_name AWS_ACCESS_KEY_ID=os.environ.get("AWS_ACCESS_KEY_ID") AWS_SECRET_ACCESS_KEY=os.environ.get("AWS_SECRET_ACCESS_KEY") @@ -259,3 +259,12 @@ def get_list(text): 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', ), } + +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', +} diff --git a/mainapp/models.py b/mainapp/models.py index da016306f..cec8bd990 100644 --- a/mainapp/models.py +++ b/mainapp/models.py @@ -5,6 +5,7 @@ import codecs from hashlib import md5 +from django.conf import settings from django.db import models from django.core.validators import RegexValidator from django.contrib.auth.models import User @@ -725,6 +726,7 @@ def full_clean(self, *args, **kwargs): def __str__(self): return self.name + class Hospital(models.Model): name = models.CharField(max_length=200) officer = models.CharField(max_length=100) @@ -740,3 +742,30 @@ def __str__(self): @classmethod def count(cls): return cls._default_manager.count() + + +@receiver(post_save, sender=Request) +@receiver(post_save, sender=RescueCamp) +@receiver(post_save, sender=Announcements) +@receiver(post_save, sender=Contributor) +@receiver(post_save, sender=DistrictNeed) +@receiver(post_save, sender=Volunteer) +@receiver(post_save, sender=DistrictManager) +@receiver(post_save, sender=Hospital) +@receiver(post_save, sender=PrivateRescueCamp) +@receiver(post_save, sender=CollectionCenter) +def expire_home_page_count_cache(sender, created, **kwargs): + if created: + home_page_setting = getattr(settings, 'HOME_PAGE_ANALYTICS', {}) + if home_page_setting.get('INVALIDATION_LOGIC', '') == 'ON_CREATE': + cache.delete(home_page_setting.get('HOME_PAGE_CACHE_KEY', 'home_page_data_statics')) + + +@receiver(post_save, sender=Volunteer) +@receiver(post_save, sender=NGO) +def expire_home_page_count_cache(sender, created, **kwargs): + if created: + home_page_setting = getattr(settings, 'HOME_PAGE_ANALYTICS', {}) + if home_page_setting.get('INVALIDATION_LOGIC', '') == 'ON_CREATE': + cache.delete(home_page_setting.get('VOLUNTEER_CACHE_KEY', 'ngo_data_statics')) + diff --git a/mainapp/views.py b/mainapp/views.py index c52cce8f9..1a065f5f4 100644 --- a/mainapp/views.py +++ b/mainapp/views.py @@ -4,6 +4,11 @@ from django.views.generic.base import TemplateView from django.views.generic.list import ListView +from django.core.cache import cache +from django.core.cache.backends.base import DEFAULT_TIMEOUT +from django.conf import settings +CACHE_TTL = getattr(settings, 'CACHE_TTL', DEFAULT_TIMEOUT) + from mainapp.redis_queue import sms_queue from mainapp.sms_handler import send_confirmation_sms from .models import Request, Volunteer, DistrictManager, Contributor, DistrictNeed, Person, RescueCamp, NGO, \ @@ -46,6 +51,8 @@ def __init__(self, *args, **kwargs): PAGE_RIGHT = 5 PAGE_INTERMEDIATE = "50" +home_page_setting = getattr(settings, 'HOME_PAGE_ANALYTICS', {}) + class CreateRequest(CreateView): model = Request template_name='mainapp/request_form.html' @@ -203,20 +210,28 @@ class HomePageView(TemplateView): template_name = "home.html" def get_context_data(self, **kwargs): - cxt = super(HomePageView, self).get_context_data(**kwargs) - cxt['request_for_rescue_count'] = Request.request_for_rescue() - cxt['request_for_resource_count'] = Request.request_for_resource() - cxt['relief_camps_count'] = RescueCamp.count() - cxt['announcement_count'] = Announcements.count() - cxt['to_contribute_count'] = Contributor.count() - cxt['district_needs_count'] = DistrictNeed.count() - cxt['volunteer_and_ngo_company_count'] = Volunteer.count() + NGO.count() - cxt['contact_info'] = DistrictManager.count() - cxt['registered_requests_count'] = "-" # todo - - cxt['hospital_count'] = Hospital.count() - cxt['private_relief_and_collection_centers_count'] = PrivateRescueCamp.count() + CollectionCenter.count() + home_page_setting = getattr(settings, 'HOME_PAGE_ANALYTICS', None) + page_data_cache_key = home_page_setting.get('HOME_PAGE_CACHE_KEY', 'home_page_data_statics') + _data = {} + if home_page_setting.get('DISPLAY', False): + if page_data_cache_key in cache: + _data = cache.get(page_data_cache_key) + else: + _data['request_for_rescue_count'] = Request.request_for_rescue() + _data['request_for_resource_count'] = Request.request_for_resource() + _data['relief_camps_count'] = RescueCamp.count() + _data['announcement_count'] = Announcements.count() + _data['to_contribute_count'] = Contributor.count() + _data['district_needs_count'] = DistrictNeed.count() + _data['volunteer_and_ngo_company_count'] = Volunteer.count() + NGO.count() + _data['contact_info'] = DistrictManager.count() + _data['registered_requests_count'] = "-" # todo + _data['hospital_count'] = Hospital.count() + _data['private_relief_and_collection_centers_count'] = PrivateRescueCamp.count() + CollectionCenter.count() + timeout = home_page_setting.get('TIMEOUT', 60 * 40) + cache.set(page_data_cache_key, _data, timeout=timeout) + cxt = super(HomePageView, self).get_context_data(**_data, home_page_setting=home_page_setting, **kwargs) return cxt @@ -224,9 +239,17 @@ class NgoVolunteerView(TemplateView): template_name = "ngo_volunteer.html" def get_context_data(self, **kwargs): - cxt = super(NgoVolunteerView, self).get_context_data(**kwargs) - cxt['registered_volunteers_count'] = 0 - cxt['registered_ngo_count'] = 0 + + page_data_cache_key = home_page_setting.get('VOLUNTEER_CACHE_KEY', 'ngo_data_statics') + _data = {} + if home_page_setting.get('DISPLAY', False): + if page_data_cache_key in cache: + _data = cache.get(page_data_cache_key) + else: + _data['registered_volunteers_count'] = Volunteer.count() + _data['registered_ngo_count'] = NGO.count() + cache.set(page_data_cache_key, _data, timeout=CACHE_TTL) + cxt = super(NgoVolunteerView, self).get_context_data(**_data, home_page_setting=home_page_setting, **kwargs) return cxt diff --git a/templates/base.html b/templates/base.html index 01079a951..8e32d1a04 100644 --- a/templates/base.html +++ b/templates/base.html @@ -17,7 +17,7 @@ - Kerala Rescue + {% block title %} {% endblock %} Kerala Rescue - ദുരിതാശ്വാസ പ്രവർത്തനങ്ങളും രക്ഷാ ദൗത്യങ്ങളും ഏകോപിപ്പിക്കാൻ {# #} diff --git a/templates/home.html b/templates/home.html index 8740d1823..2a075b3cf 100644 --- a/templates/home.html +++ b/templates/home.html @@ -1,5 +1,9 @@ {% extends 'base.html' %} {% load static %} + +{% block title %} Home | {% endblock %} + + {% block content %} {% load bootstrap3 %} @@ -26,7 +30,9 @@

Keralarescue

for rescue
രക്ഷാപ്രവർത്തനം അഭ്യർത്ഥിക്കാൻ + {% if home_page_setting.DISPLAY %} Registered: {{ request_for_rescue_count}} + {% endif %} {% bootstrap_icon "grain" %} @@ -34,8 +40,9 @@

Keralarescue

for resources
സഹായം അഭ്യർത്ഥിക്കാൻ + {% if home_page_setting.DISPLAY %} Registered: {{ request_for_resource_count}} - + {% endif %}
{% bootstrap_icon "phone" %} @@ -98,7 +117,9 @@

Keralarescue

INFO
ഞങ്ങളുമായി ബന്ധപ്പെടാൻ + {% if home_page_setting.DISPLAY %} Registered: {{contact_info}} + {% endif %}
{% bootstrap_icon "list" %} @@ -106,7 +127,9 @@

Keralarescue

ഇതു വരെ ആവശ്യപ്പെട്ടവ + {% if home_page_setting.DISPLAY %} Registered: {{registered_requests_count}} + {% endif %}
{% bootstrap_icon "plus" %} @@ -114,7 +137,9 @@

Keralarescue

ആശുപത്രികൾ + {% if home_page_setting.DISPLAY %} Registered: {{hospital_count}} + {% endif %}
{% bootstrap_icon "briefcase" %} @@ -122,7 +147,9 @@

Keralarescue

Collection Centers
സ്വകാര്യ റിലീഫ് ആൻഡ് കളക്ഷൻ സെന്ററുകൾ + {% if home_page_setting.DISPLAY %} Registered: {{private_relief_and_collection_centers_count}} + {% endif %}

For emergency support, call the District control room at 1077 or the State control room at 1070.
diff --git a/templates/ngo_volunteer.html b/templates/ngo_volunteer.html index f760e2fee..b741c59c4 100644 --- a/templates/ngo_volunteer.html +++ b/templates/ngo_volunteer.html @@ -1,5 +1,9 @@ {% extends 'base.html' %} {% load static %} + +{% block title %} Register as a Volunteer OR NGO | {% endblock %} + + {% block content %} {% load bootstrap3 %} @@ -33,7 +37,9 @@

keralarescue

Volunteers + {% if home_page_setting.DISPLAY %} Registered: {{ registered_volunteers_count }} + {% endif %} @@ -49,7 +55,9 @@

keralarescue

NGO's/Company's + {% if home_page_setting.DISPLAY %} Registered: {{ registered_ngo_count }} + {% endif %}

Contact Control Room or Disaster Management Cell or District Administration for any support.
From ac1364f019c5ebacabbdd1744af6b2a8b7a18895 Mon Sep 17 00:00:00 2001 From: JK Date: Sat, 10 Aug 2019 19:29:25 +0530 Subject: [PATCH 3/4] adding redis --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index da68b261d..3dd3df426 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,6 +15,7 @@ six==1.11.0 whitenoise==4.0 django-redis==4.9.0 requests==2.19.1 +redis==2.10.0 rq==0.12.0 pillow==5.2.0 boto3==1.7.80 From 07f4c34e04513c7dd6a803a42fd785c517e92ef4 Mon Sep 17 00:00:00 2001 From: JK Date: Sat, 10 Aug 2019 19:50:32 +0530 Subject: [PATCH 4/4] Optimization: Removed redeclaration of variable --- mainapp/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mainapp/views.py b/mainapp/views.py index 472a7b2c6..f5ddbe06f 100644 --- a/mainapp/views.py +++ b/mainapp/views.py @@ -214,7 +214,6 @@ class HomePageView(TemplateView): def get_context_data(self, **kwargs): - home_page_setting = getattr(settings, 'HOME_PAGE_ANALYTICS', None) page_data_cache_key = home_page_setting.get('HOME_PAGE_CACHE_KEY', 'home_page_data_statics') _data = {} if home_page_setting.get('DISPLAY', False):