From 006df557f1035d9fbd51f7ab94bc1de6183c09c8 Mon Sep 17 00:00:00 2001 From: muneebkattody <31755549+muneebkattody@users.noreply.github.com> Date: Sun, 26 Aug 2018 21:56:20 +0530 Subject: [PATCH 1/8] Create renew_volunteer.html --- .../templates/mainapp/renew_volunteer.html | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 mainapp/templates/mainapp/renew_volunteer.html diff --git a/mainapp/templates/mainapp/renew_volunteer.html b/mainapp/templates/mainapp/renew_volunteer.html new file mode 100644 index 000000000..b83f4f113 --- /dev/null +++ b/mainapp/templates/mainapp/renew_volunteer.html @@ -0,0 +1,131 @@ +{% extends 'base.html' %} +{% load bootstrap3 %} + +{% block content %} + + + +

Renew as Volunteer

+

വൊളന്‍റീയര്‍ പുതുക്കാൻ

+ + + + + + +{% endblock %} From a54342c4b6da0e8a5804213c5e9d46acc6d438ed Mon Sep 17 00:00:00 2001 From: Jino Jossy Date: Mon, 27 Aug 2018 19:32:46 +0530 Subject: [PATCH 2/8] initial changes for adding new view for renew as Volunteers --- mainapp/migrations/0092_auto_20180827_1632.py | 23 +++++++ mainapp/migrations/0093_auto_20180827_1657.py | 23 +++++++ mainapp/migrations/0094_volunteer_email.py | 18 +++++ mainapp/models.py | 26 ++++++- .../templates/mainapp/renew_volunteer.html | 18 ++--- mainapp/urls.py | 1 + mainapp/views.py | 39 +++++++++++ renew_volunteer_sms.py | 68 +++++++++++++++++++ requirements.txt | 2 + 9 files changed, 207 insertions(+), 11 deletions(-) create mode 100644 mainapp/migrations/0092_auto_20180827_1632.py create mode 100644 mainapp/migrations/0093_auto_20180827_1657.py create mode 100644 mainapp/migrations/0094_volunteer_email.py create mode 100644 renew_volunteer_sms.py diff --git a/mainapp/migrations/0092_auto_20180827_1632.py b/mainapp/migrations/0092_auto_20180827_1632.py new file mode 100644 index 000000000..079b3d5d1 --- /dev/null +++ b/mainapp/migrations/0092_auto_20180827_1632.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1 on 2018-08-27 11:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mainapp', '0091_merge_20180825_1236'), + ] + + operations = [ + migrations.AddField( + model_name='volunteer', + name='date_time', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='volunteer', + name='local_body', + field=models.CharField(default='', max_length=250), + ), + ] diff --git a/mainapp/migrations/0093_auto_20180827_1657.py b/mainapp/migrations/0093_auto_20180827_1657.py new file mode 100644 index 000000000..df5ddb12c --- /dev/null +++ b/mainapp/migrations/0093_auto_20180827_1657.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1 on 2018-08-27 11:27 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mainapp', '0092_auto_20180827_1632'), + ] + + operations = [ + migrations.RemoveField( + model_name='volunteer', + name='id', + ), + migrations.AlterField( + model_name='volunteer', + name='phone', + field=models.CharField(max_length=14, primary_key=True, serialize=False, validators=[django.core.validators.RegexValidator(code='invalid_mobile', message='Please Enter 10 digit mobile number or landline as 0', regex='^((\\+91|91|0)[\\- ]{0,1})?[456789]\\d{9}$')], verbose_name='Phone - ഫോണ്\u200d നമ്പര്\u200d'), + ), + ] diff --git a/mainapp/migrations/0094_volunteer_email.py b/mainapp/migrations/0094_volunteer_email.py new file mode 100644 index 000000000..ba83c9b2c --- /dev/null +++ b/mainapp/migrations/0094_volunteer_email.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1 on 2018-08-27 11:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mainapp', '0093_auto_20180827_1657'), + ] + + operations = [ + migrations.AddField( + model_name='volunteer', + name='email', + field=models.EmailField(blank=True, max_length=250), + ), + ] diff --git a/mainapp/models.py b/mainapp/models.py index d82a57ec9..3d9b2d031 100644 --- a/mainapp/models.py +++ b/mainapp/models.py @@ -2,6 +2,7 @@ import uuid from enum import Enum import csv +from datetime import datetime import codecs from django.db import models @@ -197,9 +198,10 @@ class Volunteer(models.Model): name = models.CharField(max_length=100, verbose_name="Name - പേര്") phone_number_regex = RegexValidator(regex='^((\+91|91|0)[\- ]{0,1})?[456789]\d{9}$', message='Please Enter 10 digit mobile number or landline as 0', code='invalid_mobile') - phone = models.CharField(max_length=14, verbose_name="Phone - ഫോണ്‍ നമ്പര്‍", validators=[phone_number_regex]) - + phone = models.CharField(max_length=14, verbose_name="Phone - ഫോണ്‍ നമ്പര്‍", validators=[phone_number_regex], primary_key=True) + email = models.EmailField(max_length=250, blank=True) organisation = models.CharField(max_length=250, verbose_name="Organization (സംഘടന) / Institution") + local_body = models.CharField(max_length=250, default= "") address = models.TextField(verbose_name="Address - വിലാസം") area = models.CharField( max_length = 15, @@ -208,6 +210,7 @@ class Volunteer(models.Model): ) is_spoc = models.BooleanField(default=False, verbose_name="Is point of contact") joined = models.DateTimeField(auto_now_add=True) + date_time = models.TextField(blank=True) is_active = models.BooleanField(default=True) has_consented = models.BooleanField(default=False, verbose_name="Available") @@ -218,6 +221,25 @@ class Meta: def __str__(self): return self.name + @property + def district_name(self): + return { + 'alp': 'Alappuzha - ആലപ്പുഴ', + 'ekm': 'Ernakulam - എറണാകുളം', + 'idk': 'Idukki - ഇടുക്കി', + 'knr': 'Kannur - കണ്ണൂർ', + 'ksr': 'Kasaragod - കാസർഗോഡ്', + 'kol': 'Kollam - കൊല്ലം', + 'ktm': 'Kottayam - കോട്ടയം', + 'koz': 'Kozhikode - കോഴിക്കോട്', + 'mpm': 'Malappuram - മലപ്പുറം', + 'pkd': 'Palakkad - പാലക്കാട്', + 'ptm': 'Pathanamthitta - പത്തനംതിട്ട', + 'tvm': 'Thiruvananthapuram - തിരുവനന്തപുരം', + 'tcr': 'Thrissur - തൃശ്ശൂർ', + 'wnd': 'Wayanad - വയനാട്', + }.get(self.district, 'Unknown') + class NGO(models.Model): district = models.CharField( diff --git a/mainapp/templates/mainapp/renew_volunteer.html b/mainapp/templates/mainapp/renew_volunteer.html index b83f4f113..6a0ab0dd3 100644 --- a/mainapp/templates/mainapp/renew_volunteer.html +++ b/mainapp/templates/mainapp/renew_volunteer.html @@ -6,8 +6,8 @@ @@ -15,7 +15,7 @@

Renew as Volunteer

വൊളന്‍റീയര്‍ പുതുക്കാൻ