-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/mainapp/templates/mainapp/ngo_form.html b/mainapp/templates/mainapp/ngo_form.html
index c7fde105a..50e69349f 100644
--- a/mainapp/templates/mainapp/ngo_form.html
+++ b/mainapp/templates/mainapp/ngo_form.html
@@ -6,7 +6,7 @@
Home
- Register as a Volunteer or NGO
+ Register as a Volunteer or NGO
NGO-Company Registration
diff --git a/mainapp/templates/mainapp/ngo_list.html b/mainapp/templates/mainapp/ngo_list.html
index 36e186c28..027f1393a 100644
--- a/mainapp/templates/mainapp/ngo_list.html
+++ b/mainapp/templates/mainapp/ngo_list.html
@@ -72,7 +72,7 @@
Home
- Register as a Volunteer or NGO
+ Register as a Volunteer or NGO
View Registered NGOs/Companies
diff --git a/mainapp/templates/mainapp/pcamplist.html b/mainapp/templates/mainapp/pcamplist.html
index 804093688..b71a78025 100644
--- a/mainapp/templates/mainapp/pcamplist.html
+++ b/mainapp/templates/mainapp/pcamplist.html
@@ -7,7 +7,7 @@
Home
- Private Relief & Collection Centres
+ Private Relief & Collection Centres
View Private Relief Camps
@@ -54,7 +54,7 @@ {{ message }}
diff --git a/mainapp/templates/mainapp/people.html b/mainapp/templates/mainapp/people.html
index 6b22871ff..a72771550 100644
--- a/mainapp/templates/mainapp/people.html
+++ b/mainapp/templates/mainapp/people.html
@@ -7,7 +7,7 @@
Home
- Missing or Finding Persons
+ Missing or Finding Persons
Person Finder
diff --git a/mainapp/templates/mainapp/privaterescuecamp_form.html b/mainapp/templates/mainapp/privaterescuecamp_form.html
index 1040cb367..90b6ee13e 100644
--- a/mainapp/templates/mainapp/privaterescuecamp_form.html
+++ b/mainapp/templates/mainapp/privaterescuecamp_form.html
@@ -8,7 +8,7 @@
Home
- Private Relief & Collection Centres
+ Private Relief & Collection Centres
Add Private Relief Camp
diff --git a/mainapp/templates/mainapp/relief_camps.html b/mainapp/templates/mainapp/relief_camps.html
index f6e8f1b53..67c67989d 100644
--- a/mainapp/templates/mainapp/relief_camps.html
+++ b/mainapp/templates/mainapp/relief_camps.html
@@ -32,7 +32,7 @@
നിങ്ങളുടെ സ്ഥലം നൽകുന്നതെങ്ങനെ
-
- 1. നിങ്ങളുടെ ബ്രൗസർ "www.keralarescue.in wants to know your location" എന്ന ഒരു സന്ദേശം കാണിക്കും
- 2. സന്ദേശത്തിൽ Allow തിരഞ്ഞെടുക്കുക
+ 1. കൂടുതൽ കൃത്യതക്കായി ആദ്യം നിങ്ങളുടെ ഫോണിലെ GPS ഓൺ ചെയുക.
+ 2. നിങ്ങളുടെ ബ്രൗസർ "www.keralarescue.in wants to know your location" എന്ന ഒരു സന്ദേശം കാണിക്കും
+ 3. സന്ദേശത്തിൽ Allow തിരഞ്ഞെടുക്കുക
How to allow location access
- 1. Your browser will show a message "www.keralarescue.in wants to know your location"
- 2. Choose the Allow option.
+ 1. For more accuracy, turn on your GPS firstly
+ 2. Your browser will show a message "www.keralarescue.in wants to know your location"
+ 3. Choose the Allow option.
+
+
+
+
+
+
+
Search your location
+
+
or enter comma seperated GPS coordinates:
+
+
+
+ Load
+
+
+
+
+
+
+
+
+
+
+
-
-
+
{% endblock %}
diff --git a/mainapp/templates/mainapp/request_list.html b/mainapp/templates/mainapp/request_list.html
index 93698c100..0510614ff 100644
--- a/mainapp/templates/mainapp/request_list.html
+++ b/mainapp/templates/mainapp/request_list.html
@@ -88,9 +88,10 @@ ഇതു വരെ ആവശ്യപ്പെട്ട
Request Number - അപേക്ഷ നമ്പര്
District - ജില്ല
Location - സ്ഥലം
- Requestee - അപേക്ഷകന്റെ പേര
+ Requestee - അപേക്ഷകന്റെ പേര്
Phone - ഫോണ് നമ്പര്
Date - തീയതി
+ Elapsed Time - കഴിഞ്ഞു പോയ സമയം
More details - കൂടുതൽ വിശദാംശങ്ങൾ
Update
@@ -108,7 +109,8 @@ ഇതു വരെ ആവശ്യപ്പെട്ട
{{ req.requestee_phone }}
{% endif %}
{{ req.dateadded }}
- More details
+ {{ req.dateadded|timesince }}
+ More details
Update
{% endfor %}
diff --git a/mainapp/templates/mainapp/volunteer_form.html b/mainapp/templates/mainapp/volunteer_form.html
index 7a343813b..6f2ca0707 100644
--- a/mainapp/templates/mainapp/volunteer_form.html
+++ b/mainapp/templates/mainapp/volunteer_form.html
@@ -6,7 +6,7 @@
Home
- Register as a Volunteer or NGO
+ Register as a Volunteer or NGO
Register as Volunteer
diff --git a/mainapp/templates/mainapp/volunteerview.html b/mainapp/templates/mainapp/volunteerview.html
index 8f79f4056..b12791c0a 100644
--- a/mainapp/templates/mainapp/volunteerview.html
+++ b/mainapp/templates/mainapp/volunteerview.html
@@ -52,10 +52,10 @@
}
#requests-table td:nth-of-type(1):before { content: "District - ജില്ല"; }
#requests-table td:nth-of-type(2):before { content: "Name - പേര"; }
- #requests-table td:nth-of-type(3):before { content: "Location - സ്ഥലം"; }
- #requests-table td:nth-of-type(4):before { content: "Organization - സംഘടന"; }
- #requests-table td:nth-of-type(5):before { content: "Phone - ഫോണ് നമ്പര്"; }
- #requests-table td:nth-of-type(6):before { content: "Area - സന്നദ്ധസേവനം"; }
+ #requests-table td:nth-of-type(3):before { content: "Area - സന്നദ്ധസേവനം"; }
+ #requests-table td:nth-of-type(4):before { content: "Location - സ്ഥലം"; }
+ #requests-table td:nth-of-type(5):before { content: "Organization - സംഘടന"; }
+ #requests-table td:nth-of-type(6):before { content: "Phone - ഫോണ് നമ്പര്"; }
}
@media only screen and (max-width: 420px) {
#requests-table td {
@@ -71,7 +71,7 @@
Home
- Register as a Volunteer or NGO
+ Register as a Volunteer or NGO
View Registered Volunteers
@@ -88,11 +88,11 @@ View Volunteers
District - ജില്ല
Name - പേര
+ Area - സന്നദ്ധസേവനം
{% if user.is_authenticated %}
Location - സ്ഥലം
Organization - സംഘടന
{% endif %}
- Area - സന്നദ്ധസേവനം
@@ -100,11 +100,11 @@ View Volunteers
{{ req.get_district_display }}
{{ req.name }}
+ {{ req.get_area_display }}
{% if user.is_authenticated %}
{{ req.address }}
{{ req.organisation }}
{% endif %}
- {{ req.get_area_display }}
{% endfor %}
diff --git a/mainapp/urls.py b/mainapp/urls.py
index 42247f077..fcd2a69fa 100644
--- a/mainapp/urls.py
+++ b/mainapp/urls.py
@@ -36,7 +36,7 @@
path('pcampdet/' , views.pcampdetails , name="privatecampdetails"),
path('privatecc/' , views.privatecc , name="privatedetails"),
# path('data/' , views.data , name="data"),
- path('map/' , views.mapview , name="mapview"),
+ path('map/' , views.mapview , name="map"),
path('dmodash/' , views.dmodash , name="DMODash"),
path('dmoinfo/' , views.dmoinfo , name="DMOInfo" ),
path('dmocsv/' , views.dmocsv , name="DMOCSV" ),
@@ -62,4 +62,5 @@
path('consent_success/', views.ConsentSuccess.as_view(), name='consent_success'),
url(r'c/(?P\d+)/(?P\d+)/$', views.VolunteerConsent.as_view(), name='volunteer_consent'),
url('missing_and_finding_persons/', views.ReportFindPerson.as_view(), name='report_find_person'),
+ url('hospitals/', views.HospitalView.as_view(), name='hospitals')
]
diff --git a/mainapp/views.py b/mainapp/views.py
index 0b76491b0..227ef4187 100644
--- a/mainapp/views.py
+++ b/mainapp/views.py
@@ -19,6 +19,7 @@
from django.contrib import admin
from django.shortcuts import redirect, get_object_or_404
from django.db.models import Count, QuerySet
+from django.db.models import Case, When, Sum, F
from django.core.cache import cache
from django.conf import settings
from django.contrib.auth.decorators import login_required
@@ -30,7 +31,7 @@
import csv
from dateutil import parser
import calendar
-from mainapp.models import CollectionCenter
+from mainapp.models import CollectionCenter, Hospital
from collections import OrderedDict
@@ -481,30 +482,27 @@ def dmodist(request):
return render(request , "dmodist.html" , {"camps" : d } )
def dmotal(request):
- if(request.GET.get("district",-1) == -1):return render(request , "dmotal.html" )
- dist = request.GET.get("district",-1)
- if(dist == "all"): data = RescueCamp.objects.filter(status='active').values('taluk').distinct()
- else:data = RescueCamp.objects.filter(district = dist , status='active').values('taluk').distinct()
- distmapper = {}
- for i in districts:
- distmapper[i[0]] = i[1]
- d = []
- for taluk in data :
- camps = 0 ;total_people = 0 ;total_male = 0 ; total_female = 0 ; total_infant = 0 ; total_medical = 0;district = ""
- if(dist == "all"):RCdata = RescueCamp.objects.all().filter( taluk = taluk["taluk"] , status="active")
- else:RCdata = RescueCamp.objects.all().filter( district = dist , taluk = taluk["taluk"] , status="active")
- for i in RCdata:
- camps+=1
- district = i.district
- total_people += ifnonezero(i.total_people)
- total_male += ifnonezero(i.total_males)
- total_female += ifnonezero(i.total_females)
- total_infant += ifnonezero(i.total_infants)
- if(i.medical_req.strip() != ""):total_medical+=1
-
- d.append( { "district" : distmapper[district] , "taluk" : taluk["taluk"] ,"total_camp" : camps , "total_people" : total_people , "total_male" : total_male , "total_female" : total_female , "total_infant" : total_infant , "total_medical" : total_medical } )
- return render(request , "dmotal.html" , {"camps" : d } )
-
+ dist = request.GET.get("district", -1)
+ if dist == -1:
+ return render(request, "dmotal.html")
+ camp_qs = RescueCamp.objects.filter(status='active')
+ if dist != "all":
+ data = camp_qs.filter(district=dist)
+ distmapper = dict(districts)
+ camps_by_taluk = camp_qs.values('taluk').annotate(
+ total_people=Sum('total_people'), total_male=Sum('total_males'),
+ total_female=Sum('total_females'), total_infant=Sum('total_infants'),
+ total_medical=Count(Case(
+ # Empty strings with or w/o spaces.
+ When(medical_req__regex=r'^[ ]*$', then=1),
+ # Null strings.
+ When(medical_req__isnull=True, then=1))),
+ total_camp=Count('id'), district=Value(distmapper[dist], CharField())
+ ).annotate(
+ # We wanted non-empty, non-null strings but counted the opposite. Reverse now.
+ total_medical=F('total_camp')-F('total_medical')
+ )
+ return render(request, "dmotal.html", {"camps": list(camps_by_taluk)})
def dmocsv(request):
if("district" not in request.GET.keys()):return HttpResponseRedirect("/")
@@ -522,7 +520,6 @@ def dmocsv(request):
]
writer.writerow(row)
-
return response
def ifnonezero(val):
@@ -530,21 +527,29 @@ def ifnonezero(val):
return val
def dmoinfo(request):
-
data = []
- for i in districts:
- req = 0 ; reqo = 0 ; reqd = 0 ; con = 0 ; cons = 0 ; vol = 0
- reqquery = Request.objects.all().filter(district = i[0])
- req = reqquery.count()
- reqo = reqquery.filter( status = "pro" ).count()
- reqd = reqquery.filter(status = "sup").count()
- contquery = Contributor.objects.all().filter(district = i[0])
- con = contquery.count()
- cons =contquery.filter(status = "ful").count()
- vol = Volunteer.objects.all().filter(district = i[0]).count()
-
- data.append({ "district" : i[1], "req" : req , "reqo" : reqo , "reqd" : reqd , "con" : con , "cons" : cons , "vol" : vol})
- return render(request ,"dmoinfo.html",{"data" : data} )
+ for dist_code, dist_name in districts:
+ req_summary = Request.objects.filter(district=dist_code).aggregate(
+ supplied=Count(Case(When(status="sup", then=1))),
+ progress=Count(Case(When(status="pro", then=1))),
+ total=Count('id'),
+ )
+ con_summary = Contributor.objects.filter(district=dist_code).aggregate(
+ fullfilled=Count(Case(When(status="ful", then=1))),
+ total=Count('id'),
+ )
+ vol = Volunteer.objects.filter(district=dist_code).count()
+ data.append({
+ "district": dist_name,
+ "req": req_summary['total'],
+ "reqo": req_summary['progress'],
+ "reqd": req_summary['supplied'],
+ "con": con_summary['total'],
+ "cons": con_summary['fullfilled'],
+ "vol": vol
+ })
+
+ return render(request ,"dmoinfo.html",{"data" : data})
def error(request):
error_text = request.GET.get('error_text')
@@ -834,6 +839,7 @@ def camp_requirements_list(request):
data = paginator.get_page(page)
return render(request, "mainapp/camp_requirements_list.html", {'filter': filter , 'data' : data})
+
class RequestUpdateView(CreateView):
model = RequestUpdate
template_name='mainapp/request_update.html'
@@ -899,6 +905,37 @@ def __init__(self, *args, **kwargs):
if self.data == {}:
self.queryset = self.queryset.none()
+class HospitalViewFitler(django_filters.FilterSet):
+ class Meta:
+ model = Hospital
+ fields = OrderedDict()
+ fields['name'] = ['icontains']
+ fields['designation'] = ['icontains']
+
+
+ # def __init__(self, *args, **kwargs):
+ # super(HospitalViewFitler, self).__init__(*args, **kwargs)
+ # if self.data == {}:
+ # self.queryset = self.queryset.none()
+
+
+class HospitalForm(forms.ModelForm):
+ class Meta:
+ model = Hospital
+ fields = ['name', 'designation']
+
+class HospitalView(ListView):
+ model = Hospital
+ success_url = '/hospitals/'
+ paginate_by = 50
+ template_name = 'mainapp/hospitals.html'
+
+ def get_context_data(self, **kwargs):
+ context = super().get_context_data(**kwargs)
+ context['filter'] = HospitalViewFitler(
+ self.request.GET, queryset=Hospital.objects.all()
+ )
+ return context
class CollectionCenterListView(ListView):
model = CollectionCenter
diff --git a/requirements.txt b/requirements.txt
index a5843f030..da68b261d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
dj-database-url==0.5.0
-Django==2.1
+django==2.1.2
django-bootstrap3==10.0.1
django-environ==0.4.5
django-filter==2.0.0
diff --git a/requirements_debug.txt b/requirements_debug.txt
index ae7dc1058..f87022541 100644
--- a/requirements_debug.txt
+++ b/requirements_debug.txt
@@ -1,2 +1,2 @@
-django_debug_toolbar
+django_debug_toolbar==1.11
pympler
diff --git a/static/css/style.css b/static/css/style.css
index 0d7b20c80..fceed6a5d 100644
--- a/static/css/style.css
+++ b/static/css/style.css
@@ -53,26 +53,26 @@ a.home-button:hover{
background: #333333;
color:#FFFFFF;
}
- a.home-button .glyphicon{
- font-size: 5rem;
- display: block;
- margin-bottom: 10px;
- }
- a.home-button .text{
- font-size: 2rem;
- font-weight: 500;
- text-transform: uppercase;
- display:inline-block;
- }
- a.home-button .ml{
- margin-top:7px;
- padding-top:7px;
- border-top: 1px dotted #555555;
- font-size: 1.4rem;
- font-weight: bold;
- text-transform: uppercase;
- display:inline-block;
- }
+a.home-button .glyphicon{
+ font-size: 5rem;
+ display: block;
+ margin-bottom: 10px;
+}
+a.home-button .text{
+ font-size: 1.5rem;
+ font-weight: 500;
+ text-transform: uppercase;
+ display:inline-block;
+}
+a.home-button .ml{
+ margin-top:7px;
+ padding-top:7px;
+ border-top: 1px dotted #555555;
+ font-size: 1.4rem;
+ font-weight: bold;
+ text-transform: uppercase;
+ display:inline-block;
+}
p.home-info{
font-size: 1.6rem;
font-weight: 500;
@@ -286,8 +286,8 @@ table thead tr th {
.card.priority-high{border-color:#ef7831;}
.card.priority-high .card-priority{background-color:#ef7831;}
-.card.priority-medium{border-color:#7ab754;}
- .card.priority-medium .card-priority{background-color:#7ab754;}
+.card.priority-medium{border-color:#ffc107;}
+ .card.priority-medium .card-priority{background-color:#ffc107;}
.card.priority-low{border-color:#286090;}
.card.priority-low .card-priority{background-color:#286090;}
diff --git a/templates/announcements.html b/templates/announcements.html
index cee1c414c..7e64588bd 100644
--- a/templates/announcements.html
+++ b/templates/announcements.html
@@ -15,7 +15,7 @@ Important Announcements
{% for req in pinned_data %}
- {{ req.description | safe | linebreaks }}
+ {{ req.description | safe | urlize | linebreaks }}
Very Important
{% bootstrap_icon "time" %} {{ req.dateadded }}
@@ -23,13 +23,14 @@
Important Announcements
{% endfor %}
- Priority : High Medium Low
+ Priority : High Medium Low
{% for req in data %}
+
{% bootstrap_icon "time" %} {{ req.dateadded }} {{ req.get_priority_display.upper }} priority
- {{ req.description | safe }}
+ {{ req.description | safe | urlize }}
{% if req.image %}
{% bootstrap_icon "eye-open" %} View Image
@@ -39,7 +40,6 @@ Important Announcements
class="btn btn-default card-link">{% bootstrap_icon "download" %} Download
{% endif %}
-
{% bootstrap_icon "time" %} {{ req.dateadded }}
{% endfor %}
diff --git a/templates/base.html b/templates/base.html
index 8325e3c7d..f15477ef6 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -53,7 +53,7 @@
-
+
@@ -78,15 +78,19 @@