Skip to content

Commit

Permalink
Merge branch 'main' into migrating-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
imApoorva36 authored Dec 29, 2023
2 parents a4940a4 + feaeebe commit 11252b6
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 3 deletions.
8 changes: 8 additions & 0 deletions corpus/corpus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "[email protected]")
EMAIL_HOST_PASSWORD = os.environ.get("EMAIL_HOST_PASSWORD", "gmailapppassword")
EMAIL_PORT = 465
EMAIL_USE_SSL = True
12 changes: 12 additions & 0 deletions corpus/embedathon/forms.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django import forms
from embedathon.models import Announcement
from embedathon.models import EmbedathonUser
from embedathon.models import Invite
Expand All @@ -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",
Expand All @@ -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:
Expand Down
21 changes: 21 additions & 0 deletions corpus/embedathon/migrations/0005_alter_embedathonuser_year.py
Original file line number Diff line number Diff line change
@@ -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,
),
),
]
2 changes: 1 addition & 1 deletion corpus/embedathon/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")]


Expand Down
2 changes: 1 addition & 1 deletion corpus/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion corpus/templates/embedathon/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h2>FAQs</h2>
Who is eligible to register?
</div>
<div class="collapse-content">
<p>This is going to be a pan-India event so all the <strong>1st and 2nd Year B.E/B.Tech/B.Sc
<p>This is going to be a pan-India event so all the <strong>1st, 2nd and 3rd Year B.E/B.Tech/B.Sc
students</strong> from <strong>any</strong> college can register for the event.</p>
</div>
</div>
Expand Down
14 changes: 14 additions & 0 deletions corpus/templates/embedathon/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ <h1 class="text-center">Register for Embedathon</h1>
{% endif %}
</div>

<div class="my-2" id="nitk-roll-number-field">
<label for="{{ form.nitk_roll_number.id_for_label }}">Enter NITK Roll Number:</label>
{{ form.nitk_roll_number }}
{% if form.nitk_roll_number.errors %}
<div class="my-1">
<div role="alert" class="alert alert-error">
{{ form.nitk_roll_number.errors }}
</div>
</div>
{% endif %}
</div>

<div class="w-full my-2" id="college-name-field">
<label for="{{ form.college_name.id_for_label }}">College Name</label>
{{ form.college_name }}
Expand Down Expand Up @@ -134,9 +146,11 @@ <h1 class="text-center">Register for Embedathon</h1>
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();
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ services:
restart: always
ports:
- "8000:8000"
- "465:465"
networks:
- corpus_network
volumes:
Expand Down
5 changes: 5 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]"
EMAIL_HOST_PASSWORD="smtpgmailpassword"
2 changes: 2 additions & 0 deletions prod-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ services:
restart: always
expose:
- ${DJANGO_BACKEND_PORT}
ports:
- "465:465"
networks:
- corpus_network
volumes:
Expand Down

0 comments on commit 11252b6

Please sign in to comment.