diff --git a/corpus/corpus/settings.py b/corpus/corpus/settings.py index 074ce512..260c3e38 100644 --- a/corpus/corpus/settings.py +++ b/corpus/corpus/settings.py @@ -169,3 +169,11 @@ LOGOUT_REDIRECT_URL = "/" SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") + +# Email Settings +EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" +EMAIL_HOST = os.environ.get("EMAIL_HOST", "smtp.gmail.com") +EMAIL_HOST_USER = os.environ.get("EMAIL_HOST_USER", "corpusieeenitk@gmail.com") +EMAIL_HOST_PASSWORD = os.environ.get("EMAIL_HOST_PASSWORD", "gmailapppassword") +EMAIL_PORT = 465 +EMAIL_USE_SSL = True diff --git a/corpus/embedathon/forms.py b/corpus/embedathon/forms.py index 2b82ac9c..45c5b7eb 100644 --- a/corpus/embedathon/forms.py +++ b/corpus/embedathon/forms.py @@ -1,3 +1,4 @@ +from django import forms from embedathon.models import Announcement from embedathon.models import EmbedathonUser from embedathon.models import Invite @@ -7,11 +8,14 @@ class EmbedathonForm(CorpusModelForm): + nitk_roll_number = forms.CharField(max_length=8, required=False) + class Meta: model = EmbedathonUser fields = [ "from_nitk", "college_name", + "nitk_roll_number", "course", "year", "branch", @@ -20,6 +24,14 @@ class Meta: "cass_member", ] + def clean(self): + data = self.cleaned_data + if data.get("from_nitk", None) and not data.get("nitk_roll_number", None): + raise forms.ValidationError( + "Enter your NITK Roll Number for verification that you are from NITK." + ) + return data + class TeamCreationForm(CorpusModelForm): class Meta: diff --git a/corpus/embedathon/migrations/0005_alter_embedathonuser_year.py b/corpus/embedathon/migrations/0005_alter_embedathonuser_year.py new file mode 100644 index 00000000..a79ee61b --- /dev/null +++ b/corpus/embedathon/migrations/0005_alter_embedathonuser_year.py @@ -0,0 +1,21 @@ +# Generated by Django 4.2.4 on 2023-12-27 09:59 +from django.db import migrations +from django.db import models + + +class Migration(migrations.Migration): + + dependencies = [ + ("embedathon", "0004_announcement"), + ] + + operations = [ + migrations.AlterField( + model_name="embedathonuser", + name="year", + field=models.CharField( + choices=[("1", "1st Year"), ("2", "2nd Year"), ("3", "3rd Year")], + max_length=1, + ), + ), + ] diff --git a/corpus/embedathon/models.py b/corpus/embedathon/models.py index f2f22b0f..e2f6528b 100644 --- a/corpus/embedathon/models.py +++ b/corpus/embedathon/models.py @@ -9,7 +9,7 @@ ("S", "B.Sc."), ("O", "Other undergraduate degree"), ] -YEAR = [("1", "1st Year"), ("2", "2nd Year")] +YEAR = [("1", "1st Year"), ("2", "2nd Year"), ("3", "3rd Year")] PAYMENT_STATUS = [("E", "Exempt"), ("U", "Fee Not Paid"), ("P", "Fee Paid")] diff --git a/corpus/requirements.txt b/corpus/requirements.txt index bc980db9..6dc825b3 100644 --- a/corpus/requirements.txt +++ b/corpus/requirements.txt @@ -1,5 +1,5 @@ asgiref==3.7.2 -Django==4.2.4 +Django==4.2.7 gunicorn==21.2.0 packaging==23.1 Pillow==10.0.1 diff --git a/corpus/templates/embedathon/home.html b/corpus/templates/embedathon/home.html index 8c0a69d4..88a95328 100644 --- a/corpus/templates/embedathon/home.html +++ b/corpus/templates/embedathon/home.html @@ -142,7 +142,7 @@

FAQs

Who is eligible to register?
-

This is going to be a pan-India event so all the 1st and 2nd Year B.E/B.Tech/B.Sc +

This is going to be a pan-India event so all the 1st, 2nd and 3rd Year B.E/B.Tech/B.Sc students from any college can register for the event.

diff --git a/corpus/templates/embedathon/register.html b/corpus/templates/embedathon/register.html index dda00698..47ccb9ce 100644 --- a/corpus/templates/embedathon/register.html +++ b/corpus/templates/embedathon/register.html @@ -33,6 +33,18 @@

Register for Embedathon

{% endif %} +
+ + {{ form.nitk_roll_number }} + {% if form.nitk_roll_number.errors %} +
+ +
+ {% endif %} +
+
{{ form.college_name }} @@ -134,9 +146,11 @@

Register for Embedathon

document.addEventListener("DOMContentLoaded", function () { let nitkChackbox = document.getElementById("{{ form.from_nitk.id_for_label }}"); let collegeField = document.getElementById("college-name-field"); + let nitkRollNumberField = document.getElementById("nitk-roll-number-field"); function toggleCollegeField() { collegeField.style.display = nitkChackbox.checked ? "none" : "block"; + nitkRollNumberField.style.display = nitkChackbox.checked ? "block" : "none"; } toggleCollegeField(); diff --git a/docker-compose.yml b/docker-compose.yml index 2a3afe7c..0b8198e2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,6 +38,7 @@ services: restart: always ports: - "8000:8000" + - "465:465" networks: - corpus_network volumes: diff --git a/env.example b/env.example index 071cb955..b6aa7785 100644 --- a/env.example +++ b/env.example @@ -12,3 +12,8 @@ POSTGRES_DB="corpus" POSTGRES_HOST="postgres" POSTGRES_PORT="5432" ADMINER_PORT="8080" + +# Email Settings +EMAIL_HOST="smtp.gmail.com" +EMAIL_HOST_USER="corpusieeenitk@gmail.com" +EMAIL_HOST_PASSWORD="smtpgmailpassword" diff --git a/prod-docker-compose.yml b/prod-docker-compose.yml index 43a5b835..456ba9d9 100644 --- a/prod-docker-compose.yml +++ b/prod-docker-compose.yml @@ -35,6 +35,8 @@ services: restart: always expose: - ${DJANGO_BACKEND_PORT} + ports: + - "465:465" networks: - corpus_network volumes: