Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robotrix 2024 #117

Merged
merged 23 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ed10b9d
Added model for SIGs
imApoorva36 Dec 18, 2023
ef6e3df
Merge branch 'IEEE-NITK:main' into main
imApoorva36 Dec 20, 2023
44c7fef
Merge branch 'IEEE-NITK:main' into main
yukitya-1811 Jan 21, 2024
be175aa
Merge branch 'IEEE-NITK:main' into main
imApoorva36 Jan 21, 2024
09a95b5
configured robotrix setup
imApoorva36 Jan 24, 2024
3905588
home page changes
imApoorva36 Jan 26, 2024
e6536d7
Merge branch 'main' of https://github.com/imApoorva36/corpus into rob…
imApoorva36 Feb 2, 2024
03b0cb7
data added on robotrix home page
imApoorva36 Feb 2, 2024
2733bea
Merge branch 'main' into robotrix
imApoorva36 Feb 2, 2024
867017c
Home page styling and data additions
imApoorva36 Feb 3, 2024
03f7c1c
FAQs styled and finalised
imApoorva36 Feb 3, 2024
3714f18
added phone number feature and updated latest event data
imApoorva36 Feb 18, 2024
8602fac
fixed registration display issues on home page
imApoorva36 Feb 18, 2024
a9edc20
home page logo changes
imApoorva36 Feb 18, 2024
0d2a66d
Merge branch 'main' of https://github.com/IEEE-NITK/corpus into robotrix
imApoorva36 Feb 18, 2024
56c1e9f
minor typo and other fixes
imApoorva36 Feb 18, 2024
ab79681
Merge branch 'main' of https://github.com/IEEE-NITK/corpus
imApoorva36 Feb 19, 2024
3b7af83
added phone number feature and updated latest event data
imApoorva36 Feb 18, 2024
7319160
fixed registration display issues on home page
imApoorva36 Feb 18, 2024
0fb7557
home page logo changes
imApoorva36 Feb 18, 2024
80b2eb3
minor typo and other fixes
imApoorva36 Feb 18, 2024
802476f
fixed minor issues
imApoorva36 Feb 19, 2024
ec3a97a
Fixed minor issues
imApoorva36 Feb 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.4 on 2024-01-24 13:40
import datetime

from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

dependencies = [
("accounts", "0003_alter_executivemember_date_joined"),
]

operations = [
migrations.AlterField(
model_name="executivemember",
name="date_joined",
field=models.DateTimeField(
default=datetime.datetime(2024, 1, 24, 19, 10, 0, 912845),
verbose_name="Date Joined",
),
),
]
5 changes: 3 additions & 2 deletions corpus/corpus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = (os.getenv("ENVIRONMENT") == "DEVELOPMENT") or (
os.getenv("LIVECYCLE") is not None
os.getenv("LIVECYCLE") is not None
anirudhprabhakaran3 marked this conversation as resolved.
Show resolved Hide resolved
)

# TODO: Stricter host policies
Expand Down Expand Up @@ -57,7 +57,8 @@
"embedathon.apps.EmbedathonConfig",
"impulse.apps.ImpulseConfig",
"electrika.apps.ElectrikaConfig",
"skyward_expedition.apps.SkywardExpeditionConfig"
"robotrix.apps.RobotrixConfig",
"skyward_expedition.apps.SkywardExpeditionConfig",
anirudhprabhakaran3 marked this conversation as resolved.
Show resolved Hide resolved
]

MIDDLEWARE = [
Expand Down
1 change: 1 addition & 0 deletions corpus/corpus/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
path("impulse/", include("impulse.urls")),
path("electrika/", include("electrika.urls")),
path("skyward_expedition/", include("skyward_expedition.urls")),
path("robotrix/", include("robotrix.urls")),
]
Empty file added corpus/robotrix/__init__.py
Empty file.
12 changes: 12 additions & 0 deletions corpus/robotrix/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.contrib import admin
from robotrix.models import Announcement
from robotrix.models import Invite
from robotrix.models import RobotrixUser
from robotrix.models import Team

# Register your models here.

admin.site.register(RobotrixUser)
admin.site.register(Team)
admin.site.register(Announcement)
admin.site.register(Invite)
6 changes: 6 additions & 0 deletions corpus/robotrix/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class RobotrixConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "robotrix"
69 changes: 69 additions & 0 deletions corpus/robotrix/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from django import forms
from robotrix.models import Announcement
from robotrix.models import Invite
from robotrix.models import RobotrixUser
from robotrix.models import Team

from corpus.forms import CorpusModelForm


class RobotrixForm(CorpusModelForm):
class Meta:
model = RobotrixUser
fields = [
"from_nitk",
"college_name",
"roll_no",
"ieee_member",
"ieee_membership_no",
"phone_no",
]

def clean(self):
data = self.cleaned_data
if data.get("from_nitk", None) and not data.get("roll_no", None):
raise forms.ValidationError(
"Enter your roll number for verification that you are from NITK"
)

if data.get("ieee_member", None) and not data.get("ieee_membership_no", None):
raise forms.ValidationError(
"Enter your IEEE Membership Number for verification "
+ "that you are an IEEE member"
)

return data


class TeamCreationForm(CorpusModelForm):
class Meta:
model = Team
fields = ["team_name"]


class AnnouncementForm(CorpusModelForm):
ANNOUNCEMENT_OPTIONS = [
("1", "No email to be sent."),
("2", "Send email to all team leaders."),
("3", "Send email to all members"),
]

announcement_mailing = forms.ChoiceField(
widget=forms.Select, choices=ANNOUNCEMENT_OPTIONS
)

class Meta:
model = Announcement
fields = [
"content",
"url_link",
"url_link_text",
"announcement_type",
"announcement_mailing",
]


class InviteForm(CorpusModelForm):
class Meta:
model = Invite
fields = ["invite_email"]
160 changes: 160 additions & 0 deletions corpus/robotrix/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Generated by Django 4.2.4 on 2024-02-18 14:33
import django.db.models.deletion
from django.conf import settings
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name="Announcement",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("content", models.TextField()),
("url_link", models.URLField(blank=True, null=True)),
(
"url_link_text",
models.CharField(blank=True, max_length=200, null=True),
),
(
"announcement_type",
models.CharField(
choices=[
("A", "All Robotrix Users"),
("P", "Paid Teams"),
("U", "Unpaid Teams"),
("N", "Registered for Robotrix but no team"),
("NI", "Not Registered for Robotrix"),
],
default="A",
max_length=2,
),
),
("date_created", models.DateTimeField(auto_now_add=True)),
("date_modified", models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name="RobotrixUser",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("from_nitk", models.BooleanField(default=True)),
(
"college_name",
models.CharField(
default="National Institute of Technology Karnataka",
max_length=200,
),
),
("roll_no", models.CharField(blank=True, max_length=8, null=True)),
("ieee_member", models.BooleanField(default=False)),
("ieee_membership_no", models.BigIntegerField(blank=True, null=True)),
(
"phone_no",
models.CharField(
max_length=15, unique=True, verbose_name="Phone Number"
),
),
],
),
migrations.CreateModel(
name="Team",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("team_name", models.CharField(max_length=200)),
(
"payment_status",
models.CharField(
choices=[
("E", "Exempt"),
("U", "Fee Not Paid"),
("P", "Fee Paid"),
],
default="U",
max_length=1,
),
),
(
"team_leader",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="leader",
to="robotrix.robotrixuser",
),
),
],
),
migrations.AddField(
model_name="robotrixuser",
name="team",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="team",
to="robotrix.team",
),
),
migrations.AddField(
model_name="robotrixuser",
name="user",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
),
),
migrations.CreateModel(
name="Invite",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("invite_email", models.EmailField(max_length=254)),
(
"inviting_team",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="invite_to_team",
to="robotrix.team",
),
),
],
),
]
Empty file.
72 changes: 72 additions & 0 deletions corpus/robotrix/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
from accounts.models import User
from django.db import models
from embedathon.models import PAYMENT_STATUS


class RobotrixUser(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
from_nitk = models.BooleanField(default=True)
college_name = models.CharField(
max_length=200, default="National Institute of Technology Karnataka"
)
roll_no = models.CharField(max_length=8, blank=True, null=True)
ieee_member = models.BooleanField(default=False)
ieee_membership_no = models.BigIntegerField(blank=True, null=True)
phone_no = models.CharField(
max_length=15,
unique=True,
verbose_name="Phone Number",
)
team = models.ForeignKey(
"Team", on_delete=models.CASCADE, related_name="team", blank=True, null=True
)

def __str__(self):
return self.user.email


class Team(models.Model):
team_name = models.CharField(max_length=200, blank=False, null=False)
team_leader = models.ForeignKey(
RobotrixUser, on_delete=models.CASCADE, related_name="leader"
)

payment_status = models.CharField(
max_length=1, choices=PAYMENT_STATUS, blank=False, null=False, default="U"
)

def __str__(self):
return self.team_name


class Announcement(models.Model):

AnnouncementType = (
("A", "All Robotrix Users"),
("P", "Paid Teams"),
("U", "Unpaid Teams"),
("N", "Registered for Robotrix but no team"),
("NI", "Not Registered for Robotrix"),
)

content = models.TextField(blank=False, null=False)
url_link = models.URLField(blank=True, null=True)
url_link_text = models.CharField(max_length=200, blank=True, null=True)
announcement_type = models.CharField(
max_length=2, choices=AnnouncementType, blank=False, null=False, default="A"
)
date_created = models.DateTimeField(auto_now_add=True)
date_modified = models.DateTimeField(auto_now=True)

def __str__(self):
return self.content[:20] + "..."


class Invite(models.Model):
inviting_team = models.ForeignKey(
Team, on_delete=models.CASCADE, related_name="invite_to_team"
)
invite_email = models.EmailField(blank=False, null=False)

def __str__(self):
return self.invite_email
Loading
Loading