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

Team page #149

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1b74e6e
Added tab component and styled it appropriately
yukitya-1811 Jan 24, 2024
8444015
Basic HTML for Team Page done
yukitya-1811 Jan 26, 2024
86d134d
Added profile_picture to ExecutiveMember model
yukitya-1811 Jan 26, 2024
b63753e
Finalized HTML for Faculty and Member separation on each sig tab
yukitya-1811 Feb 6, 2024
21f06b0
Finished section separation within each sig tab for Faculty, Core and…
yukitya-1811 Feb 8, 2024
1cbbfcb
Added logic to fetch coremember pfp from execmember
yukitya-1811 Feb 8, 2024
393a8b2
Fixed light mode colours
yukitya-1811 Feb 19, 2024
2b2c602
Finished layout for member cards and buttons
yukitya-1811 Feb 24, 2024
2448232
Fixed minor issue (Piston members being loaded in Diode members section)
yukitya-1811 Feb 24, 2024
1f25a8d
Formatted code for better readability
yukitya-1811 Feb 24, 2024
0957689
Fixed centering of tablist issue (Finally)
yukitya-1811 Feb 28, 2024
0f96a94
Added links to all Github and Linkedin buttons
yukitya-1811 Feb 28, 2024
f3d8796
Added proper verbose_name_plural for Faculty
yukitya-1811 Feb 28, 2024
e540e5e
After pre commit hooks
yukitya-1811 Feb 28, 2024
ec7265c
Revert "Added links to all Github and Linkedin buttons"
yukitya-1811 Feb 28, 2024
d831b7f
Resolving conflicts #1
yukitya-1811 Feb 28, 2024
301a96d
Add Team link to small navbar
yukitya-1811 Mar 12, 2024
7764e60
DB fix commit
yukitya-1811 Mar 12, 2024
2394e7e
Made pre-commit changes
yukitya-1811 Mar 13, 2024
b44baa4
Added default pfp png
yukitya-1811 Mar 13, 2024
f1debe5
Made requested changes
yukitya-1811 Mar 13, 2024
5b05494
Finished faculty website buttons
yukitya-1811 Mar 13, 2024
c7bb70a
Added checks for links belonging to Faculty model
yukitya-1811 Mar 13, 2024
110917f
Cleaned up migrations
yukitya-1811 Feb 29, 2024
6d446bd
Changed upload folder for profile pictures to accounts/executivemember
yukitya-1811 Mar 6, 2024
1639e76
Update corpus/pages/urls.py
yukitya-1811 Mar 6, 2024
bbd88ca
Revert "Added checks for links belonging to Faculty model"
yukitya-1811 Mar 13, 2024
a00ee2c
Revert "Fixed conflicts"
yukitya-1811 Mar 13, 2024
98c6858
Fixed html issues and query logic
yukitya-1811 Mar 14, 2024
8ef8c1b
Fixed html indentation and member fetching query to exclude faculty u…
yukitya-1811 Mar 14, 2024
e049df2
Change upload directory of profile pictures
yukitya-1811 Mar 22, 2024
90f109f
Add core post to string representation
yukitya-1811 Mar 22, 2024
d3443fa
Minor change in path string for teampage
yukitya-1811 Mar 22, 2024
11eea97
Squash migrations
yukitya-1811 Mar 23, 2024
8136437
Add dummydata
yukitya-1811 Apr 20, 2024
90227bd
Revert "Add dummydata"
yukitya-1811 Apr 21, 2024
dc2db60
Change migration dependencies
yukitya-1811 Apr 24, 2024
fb6707e
Fix migration files
yukitya-1811 May 13, 2024
e56b127
Add new migration file for Faculty, Core models
yukitya-1811 May 13, 2024
49ea960
Minor changes
yukitya-1811 May 13, 2024
228392c
Change views.py logic and change models to facilitate better fetching…
yukitya-1811 May 16, 2024
d51e36b
Squash migrations
yukitya-1811 May 16, 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
14 changes: 13 additions & 1 deletion corpus/accounts/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin

from .models import Core
from .models import ExecutiveMember
from .models import Faculty
from .models import User

# Register your models here.
Expand Down Expand Up @@ -67,7 +69,7 @@ class ExecutiveMemberAdmin(admin.ModelAdmin):
),
(
"IEEE Related Details",
{"fields": ("ieee_number", "ieee_email")},
{"fields": ("ieee_number", "ieee_email", "profile_picture")},
),
("Socials", {"fields": ("linkedin", "github")}),
)
Expand All @@ -82,5 +84,15 @@ class ExecutiveMemberAdmin(admin.ModelAdmin):
ordering = ("user",)


class CoreAdmin(admin.ModelAdmin):
list_display = ("executivemember", "sig", "post", "term_start")


class FacultyAdmin(admin.ModelAdmin):
list_display = ("user", "sig", "post", "term_start")


admin.site.register(User, CorpusUserAdmin)
admin.site.register(ExecutiveMember, ExecutiveMemberAdmin)
admin.site.register(Core, CoreAdmin)
admin.site.register(Faculty, FacultyAdmin)
yukitya-1811 marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# Generated by Django 4.2.7 on 2024-03-23 21:12
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

dependencies = [
("config", "0004_sig_society_sigs"),
("accounts", "0003_alter_executivemember_date_joined"),
]

operations = [
migrations.AddField(
model_name="executivemember",
name="profile_picture",
field=models.ImageField(
blank=True,
null=True,
upload_to="accounts/executivemember/profile_picture",
),
),
migrations.AlterField(
model_name="executivemember",
name="date_joined",
field=models.DateTimeField(
default=django.utils.timezone.now, verbose_name="Date Joined"
),
),
migrations.AlterField(
model_name="executivemember",
name="github",
field=models.CharField(
blank=True, max_length=200, null=True, verbose_name="GitHub Username"
),
),
migrations.CreateModel(
name="Faculty",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"post",
models.CharField(
blank=True,
choices=[
("Branch Counselor", "Branch Counselor"),
("CIS Faculty Advisor", "CIS Faculty Advisor"),
("CompSoc Faculty Advisor", "CompSoc Faculty Advisor"),
("CAS Faculty Advisor", "CAS Faculty Advisor"),
("SPS Faculty Advisor", "SPS Faculty Advisor"),
(
"Photonic Society Faculty Advisor",
"Photonic Society Faculty Advisor",
),
("WIE Faculty Advisor", "WIE Faculty Advisor"),
("IAS Faculty Advisor", "IAS Faculty Advisor"),
("SIGHT Chair", "SIGHT Chair"),
("RAS Faculty Advisor", "RAS Faculty Advisor"),
("GRSS Faculty Advisor", "GRSS Faculty Advisor"),
],
max_length=100,
),
),
("term_start", models.DateField()),
("term_end", models.DateField()),
("website", models.URLField(blank=True, null=True)),
(
"sig",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="config.sig"
),
),
(
"user",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"verbose_name_plural": "faculties",
},
),
migrations.CreateModel(
name="Core",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"post",
models.IntegerField(
choices=[
(1, "Convenor"),
(2, "Chairperson"),
(3, "Vice Chairperson"),
(4, "Secretary"),
(5, "Joint Secretary"),
(6, "Treasurer(Branch)"),
(7, "Treasurer(Institute)"),
(8, "Webmaster"),
(9, "Media Lead"),
(10, "Outreach Lead"),
(11, "Envision Lead"),
(12, "Labs Lead"),
(13, "CompSoc Chair"),
(14, "CompSoc Vice Chair"),
(15, "CompSoc Secretary"),
(16, "CompSoc Project Head"),
(17, "CompSoc Project Coordinator"),
(18, "CIS Chair"),
(19, "CIS Secretary"),
(20, "CIS Project Head"),
(21, "Diode Chair"),
(22, "SPS Chair"),
(23, "SPS Vice Chair"),
(24, "SPS Secretary"),
(25, "CAS Chair"),
(26, "CAS Vice Chair"),
(27, "CAS Secretary"),
(28, "RAS Chair"),
(29, "RAS Secretary"),
(30, "Piston Chair"),
(31, "Piston Vice Chair"),
(32, "Piston Secretary"),
(33, "IAS Chair"),
(34, "IAS Secretary"),
]
),
),
("term_start", models.DateField()),
("term_end", models.DateField()),
(
"executivemember",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to="accounts.executivemember",
),
),
(
"sig",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="config.sig"
),
),
],
),
]
yukitya-1811 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class Migration(migrations.Migration):

dependencies = [
("accounts", "0004_alter_executivemember_date_joined"),
("accounts", "0004_executivemember_profile_picture_and_more"),
]

operations = [
Expand Down
92 changes: 88 additions & 4 deletions corpus/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.contrib.auth.base_user import BaseUserManager
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils import timezone
from django.utils.timezone import now
yukitya-1811 marked this conversation as resolved.
Show resolved Hide resolved
from django.utils.translation import gettext_lazy as _

from .validators import validate_ieee_email
Expand Down Expand Up @@ -134,14 +134,15 @@ class ExecutiveMember(models.Model):
blank=True, null=True, verbose_name="Linkedin Profile URL"
)

profile_picture = models.ImageField(
blank=True, null=True, upload_to="accounts/executivemember/profile_picture"
)
# TODO: Phase out with GitHub OAuth details
github = models.CharField(
max_length=39, blank=True, null=True, verbose_name="GitHub Username"
)
is_nep = models.BooleanField(default=False, verbose_name="Is NEP Member?")
date_joined = models.DateTimeField(
default=timezone.now(), verbose_name="Date Joined"
)
date_joined = models.DateTimeField(verbose_name="Date Joined", default=now)

def save(self, *args, **kwargs):
self.roll_number = self.roll_number.upper()
Expand All @@ -150,3 +151,86 @@ def save(self, *args, **kwargs):

def __str__(self):
return f"{self.user.first_name} {self.user.last_name} [{self.sig.name}]"


class Core(models.Model):

POST_CHOICES = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on call, any reason for this? I think it'll be better to make another model or something called Post and have a ForeignKey linking to that table.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, would the mapping remain the same for the core posts then? Like rn I'm having a POST_CHOICES which maps every core post to a number, according to which the core posts are fetched and displayed. So can I move this exact logic to the Post model when I create it?

(1, "Convenor"),
(2, "Chairperson"),
(3, "Vice Chairperson"),
(4, "Secretary"),
(5, "Joint Secretary"),
(6, "Treasurer(Branch)"),
(7, "Treasurer(Institute)"),
(8, "Webmaster"),
(9, "Media Lead"),
(10, "Outreach Lead"),
(11, "Envision Lead"),
(12, "Labs Lead"),
(13, "CompSoc Chair"),
(14, "CompSoc Vice Chair"),
(15, "CompSoc Secretary"),
(16, "CompSoc Project Head"),
(17, "CompSoc Project Coordinator"),
(18, "CIS Chair"),
(19, "CIS Secretary"),
(20, "CIS Project Head"),
(21, "Diode Chair"),
(22, "SPS Chair"),
(23, "SPS Vice Chair"),
(24, "SPS Secretary"),
(25, "CAS Chair"),
(26, "CAS Vice Chair"),
(27, "CAS Secretary"),
(28, "RAS Chair"),
(29, "RAS Secretary"),
(30, "Piston Chair"),
(31, "Piston Vice Chair"),
(32, "Piston Secretary"),
(33, "IAS Chair"),
(34, "IAS Secretary"),
)
executivemember = models.OneToOneField(
ExecutiveMember, null=False, on_delete=models.CASCADE
)
post = models.IntegerField(null=False, choices=POST_CHOICES)
sig = models.ForeignKey(SIG, null=False, on_delete=models.CASCADE)
term_start = models.DateField()
term_end = models.DateField()

def __str__(self):
self_user = self.executivemember.user
return (
f"{self_user.first_name} {self_user.last_name} | {self.get_post_display()}"
)

def get_post_display(self):
return dict(Core.POST_CHOICES).get(self.post)


class Faculty(models.Model):
class Meta:
verbose_name_plural = "faculties"

FACULTY_POSTS = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also go into the Post model. Then no need to differentiate by like faculty posts and stuff

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. I would like Faculty to be in a different model. Core members have to be Executive Members, Faculty will only be Users. The foreign key references will be different.

Also, access control in the future will be much easier if we have these models separate.

("Branch Counselor", "Branch Counselor"),
("CIS Faculty Advisor", "CIS Faculty Advisor"),
("CompSoc Faculty Advisor", "CompSoc Faculty Advisor"),
("CAS Faculty Advisor", "CAS Faculty Advisor"),
("SPS Faculty Advisor", "SPS Faculty Advisor"),
("Photonic Society Faculty Advisor", "Photonic Society Faculty Advisor"),
("WIE Faculty Advisor", "WIE Faculty Advisor"),
("IAS Faculty Advisor", "IAS Faculty Advisor"),
("SIGHT Chair", "SIGHT Chair"),
("RAS Faculty Advisor", "RAS Faculty Advisor"),
("GRSS Faculty Advisor", "GRSS Faculty Advisor"),
)
user = models.OneToOneField(User, null=False, on_delete=models.CASCADE)
sig = models.ForeignKey(SIG, null=False, on_delete=models.CASCADE)
post = models.CharField(
max_length=100, null=False, choices=FACULTY_POSTS, blank=True
)
term_start = models.DateField()
term_end = models.DateField()
website = models.URLField(max_length=200, null=True, blank=True)
2 changes: 2 additions & 0 deletions corpus/corpus/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from ckeditor_uploader import views as ckeditor_views
from django.conf import settings
from django.conf.urls.static import static
from django.conf import settings
from django.conf.urls.static import static
yukitya-1811 marked this conversation as resolved.
Show resolved Hide resolved
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from django.urls import include
Expand Down
14 changes: 12 additions & 2 deletions corpus/impulse/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,12 @@ def mark_payment_complete(request, pk):
send_email(
"Payment Complete | Impulse",
"emails/impulse/payment_complete.html",
{"team": team, "user": member.user, "payment_status": payment_status, "final_message": final_message},
{
"team": team,
"user": member.user,
"payment_status": payment_status,
"final_message": final_message,
},
yukitya-1811 marked this conversation as resolved.
Show resolved Hide resolved
bcc=[member.user.email],
)
messages.success(
Expand All @@ -514,7 +519,12 @@ def mark_payment_incomplete(request, pk):
send_email(
"Payment Incomplete | Impulse",
"emails/impulse/payment_incomplete.html",
{"team": team, "user": member.user, "payment_status": payment_status, "final_message": final_message},
{
"team": team,
"user": member.user,
"payment_status": payment_status,
"final_message": final_message,
},
bcc=[member.user.email],
)
messages.success(request, "Successfully marked payment as incomplete!")
Expand Down
1 change: 1 addition & 0 deletions corpus/pages/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
path("", views.index, name="index"),
path("about_us/", views.about_us, name="about_us"),
path("sig/<str:sig_name>/", views.sig, name="sig"),
path("team/", views.team, name="team"),
]
Loading
Loading