summaryrefslogtreecommitdiff
path: root/workshop_app
diff options
context:
space:
mode:
Diffstat (limited to 'workshop_app')
-rw-r--r--workshop_app/admin.py8
-rw-r--r--workshop_app/forms.py30
-rw-r--r--workshop_app/models.py26
-rw-r--r--workshop_app/send_mails.py12
4 files changed, 64 insertions, 12 deletions
diff --git a/workshop_app/admin.py b/workshop_app/admin.py
index 11f7b6d..a28cdb3 100644
--- a/workshop_app/admin.py
+++ b/workshop_app/admin.py
@@ -14,7 +14,7 @@ except ImportError:
#Custom Classes
class ProfileAdmin(admin.ModelAdmin):
- list_display = ['user', 'institute','department','phone_number','position']
+ list_display = ['title','user', 'institute','location','department','phone_number','position']
list_filter = ['position', 'department']
actions = ['download_csv']
@@ -25,12 +25,12 @@ class ProfileAdmin(admin.ModelAdmin):
filename=profile_data.csv'
writer = csv.writer(response)
- writer.writerow(['user', 'institute','department','phone_number',
+ writer.writerow(['title','user', 'institute', 'location','department','phone_number',
'position'])
for q in queryset:
- writer.writerow([q.user, q.institute,
- q.department, q.phone_number,
+ writer.writerow([q.title, q.user, q.institute,
+ q.location, q.department, q.phone_number,
q.position])
openfile.seek(0)
diff --git a/workshop_app/forms.py b/workshop_app/forms.py
index 1e9eb05..8ba486e 100644
--- a/workshop_app/forms.py
+++ b/workshop_app/forms.py
@@ -37,6 +37,28 @@ department_choices = (
("others", "Others"),
)
+title = (
+ ("Professor", "Prof."),
+ ("Doctor", "Dr."),
+ ("Shriman", "Shri"),
+ ("Shrimati", "Smt"),
+ ("Kumari", "Ku"),
+ ("Mr", "Mr."),
+ ("Mrs", "Mrs."),
+ ("Miss", "Ms."),
+ ("other", "Other"),
+ )
+
+source = (
+ ("FOSSEE Email", "FOSSEE Email"),
+ ("FOSSEE website", "FOSSEE website"),
+ ("Google", "Google"),
+ ("Social Media", "Social Media"),
+ ("From other College", "From other College"),
+ ("Others", "Others"),
+ )
+
+
class UserRegistrationForm(forms.Form):
"""A Class to create new form for User's Registration.
It has the various fields and functions required to register
@@ -49,6 +71,8 @@ class UserRegistrationForm(forms.Form):
password = forms.CharField(max_length=32, widget=forms.PasswordInput())
confirm_password = forms.CharField\
(max_length=32, widget=forms.PasswordInput())
+
+ title = forms.ChoiceField(choices=title)
first_name = forms.CharField(max_length=32)
last_name = forms.CharField(max_length=32)
phone_number = forms.RegexField(regex=r'^.{10}$',
@@ -59,7 +83,8 @@ class UserRegistrationForm(forms.Form):
help_text='Please write full name of your Institute/Organization')
department = forms.ChoiceField(help_text='Department you work/study',
choices=department_choices)
-
+ location = forms.CharField(max_length=255, help_text="Place/City")
+ source = forms.ChoiceField(choices=source)
def clean_username(self):
u_name = self.cleaned_data["username"]
@@ -110,6 +135,9 @@ class UserRegistrationForm(forms.Form):
new_profile.department = cleaned_data["department"]
#new_profile.position = cleaned_data["position"]
new_profile.phone_number = cleaned_data["phone_number"]
+ new_profile.location = cleaned_data["location"]
+ new_profile.title = cleaned_data["title"]
+ new_profile.source = cleaned_data["source"]
new_profile.activation_key = generate_activation_key(new_user.username)
new_profile.key_expiry_time = timezone.now() + \
timezone.timedelta(days=1)
diff --git a/workshop_app/models.py b/workshop_app/models.py
index b3ca1fc..5ee9150 100644
--- a/workshop_app/models.py
+++ b/workshop_app/models.py
@@ -24,6 +24,27 @@ department_choices = (
("others", "Others"),
)
+title = (
+ ("Professor", "Prof."),
+ ("Doctor", "Dr."),
+ ("Shriman", "Shri"),
+ ("Shrimati", "Smt"),
+ ("Kumari", "Ku"),
+ ("Mr", "Mr."),
+ ("Mrs", "Mrs."),
+ ("Miss", "Ms."),
+ ("other", "Other"),
+ )
+
+source = (
+ ("FOSSEE Email", "FOSSEE Email"),
+ ("FOSSEE website", "FOSSEE website"),
+ ("Google", "Google"),
+ ("Social Media", "Social Media"),
+ ("From other College", "From other College"),
+ ("Others", "Others"),
+ )
+
def has_profile(user):
""" check if user has profile """
@@ -36,6 +57,7 @@ class Profile(models.Model):
"""Profile for users(instructors and coordinators)"""
user = models.OneToOneField(User)
+ title = models.CharField(max_length=32,blank=True, choices=title)
institute = models.CharField(max_length=150)
department = models.CharField(max_length=150, choices=department_choices)
phone_number = models.CharField(
@@ -52,6 +74,8 @@ class Profile(models.Model):
help_text='Select Coordinator if you want to organise a workshop\
in your college/school. <br> Select Instructor if you want to conduct\
a workshop.')
+ source = models.CharField(max_length=255, blank=True,choices=source)
+ location = models.CharField(max_length=255,blank=True, help_text="Place/City")
is_email_verified = models.BooleanField(default=False)
activation_key = models.CharField(max_length=255, blank=True, null=True)
key_expiry_time = models.DateTimeField(blank=True, null=True)
@@ -61,7 +85,7 @@ class Profile(models.Model):
self.user.id,
self.user.first_name,
self.user.last_name,
- self.user.email
+ self.user.email,
)
diff --git a/workshop_app/send_mails.py b/workshop_app/send_mails.py
index 89992d2..32d6f71 100644
--- a/workshop_app/send_mails.py
+++ b/workshop_app/send_mails.py
@@ -105,7 +105,7 @@ def send_email( request, call_on,
try:
send_mail(
"Coordinator Registration at FOSSEE, IIT Bombay", message, SENDER_EMAIL,
- [request.user.email], fail_silently=False
+ [request.user.email], fail_silently=True
)
except Exception:
@@ -137,7 +137,7 @@ def send_email( request, call_on,
send_mail(
"New FOSSEE Workshop booking on {0}".format(workshop_date),
message, SENDER_EMAIL, [other_email],
- fail_silently=False
+ fail_silently=True
)
except Exception:
send_smtp_email(request=request,
@@ -168,7 +168,7 @@ def send_email( request, call_on,
send_mail(
"Pending Request for New FOSSEE Workshop booking on {0}"
.format(workshop_date), message, SENDER_EMAIL,
- [request.user.email], fail_silently=False
+ [request.user.email], fail_silently=True
)
except Exception:
send_smtp_email(request=request,
@@ -257,7 +257,7 @@ def send_email( request, call_on,
try:
send_mail("FOSSEE Workshop booking rejected for {0}"
.format(workshop_date), message, SENDER_EMAIL,
- [request.user.email], fail_silently=False)
+ [request.user.email], fail_silently=True)
except Exception:
send_smtp_email(request=request,
subject="FOSSEE Workshop booking rejected for {0}".
@@ -279,7 +279,7 @@ def send_email( request, call_on,
try:
send_mail("FOSSEE Workshop booking rejected for {0}".
format(workshop_date), message, SENDER_EMAIL,
- [other_email], fail_silently=False)
+ [other_email], fail_silently=True)
except Exception:
send_smtp_email(request=request,
subject="FOSSEE Workshop booking rejected for {0}".
@@ -297,7 +297,7 @@ def send_email( request, call_on,
try:
send_mail("FOSSEE workshop deleted for {0}".format(workshop_date),
message, SENDER_EMAIL, [request.user.email],
- fail_silently=False)
+ fail_silently=True)
except Exception:
send_smtp_email(request=request,
subject="FOSSEE Workshop deleted for {0}".