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

Added Teams page #132

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9c4098e
Added tab component and styled it appropriately
yukitya-1811 Jan 24, 2024
ccd4530
Basic HTML for Team Page done
yukitya-1811 Jan 26, 2024
e76ad81
Added profile_picture to ExecutiveMember model
yukitya-1811 Jan 26, 2024
3fbe833
Merge branch 'IEEE-NITK:main' into TeamPage
yukitya-1811 Jan 26, 2024
1c52b05
Finalized HTML for Faculty and Member separation on each sig tab
yukitya-1811 Feb 6, 2024
3da4e98
Finished section separation within each sig tab for Faculty, Core and…
yukitya-1811 Feb 8, 2024
a4f0904
Added logic to fetch coremember pfp from execmember
yukitya-1811 Feb 8, 2024
a6c0b67
Fixed light mode colours
yukitya-1811 Feb 19, 2024
880b625
Finished layout for member cards and buttons
yukitya-1811 Feb 24, 2024
9fb8c57
Fixed minor issue (Piston members being loaded in Diode members section)
yukitya-1811 Feb 24, 2024
f856a07
Formatted code for better readability
yukitya-1811 Feb 24, 2024
33c47bd
Fixed centering of tablist issue (Finally)
yukitya-1811 Feb 28, 2024
4cd43dd
Added links to all Github and Linkedin buttons
yukitya-1811 Feb 28, 2024
4de896a
Added proper verbose_name_plural for Faculty
yukitya-1811 Feb 28, 2024
c364ec3
After pre commit hooks
yukitya-1811 Feb 28, 2024
75c2922
Revert "Added links to all Github and Linkedin buttons"
yukitya-1811 Feb 28, 2024
57f503f
Merge branch 'main' into TeamPage
yukitya-1811 Feb 28, 2024
34c08e3
Resolving conflicts #1
yukitya-1811 Feb 28, 2024
9e153fd
Merge branch 'TeamPage' of https://github.com/yukitya-1811/corpus int…
yukitya-1811 Feb 28, 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
12 changes: 11 additions & 1 deletion corpus/accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

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

# 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 @@ -81,6 +83,14 @@ class ExecutiveMemberAdmin(admin.ModelAdmin):
)
ordering = ("user",)

class CoreAdmin(admin.ModelAdmin):
list_display = ("user", "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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.7 on 2024-01-26 20:50

from django.db import migrations, models


class Migration(migrations.Migration):

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

operations = [
migrations.AddField(
model_name='executivemember',
name='profile_picture',
field=models.ImageField(blank=True, null=True, upload_to=''),
),
migrations.AlterField(
model_name='executivemember',
name='date_joined',
field=models.DateTimeField(verbose_name='Date Joined'),
),
]
24 changes: 23 additions & 1 deletion corpus/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,16 @@ class ExecutiveMember(models.Model):
blank=True, null=True, verbose_name="Linkedin Profile URL"
)

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

def save(self, *args, **kwargs):
Expand All @@ -151,3 +154,22 @@ 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):
user = models.OneToOneField(User, null=False, on_delete=models.CASCADE)
post = models.CharField(max_length=100, null=False)
sig = models.ForeignKey(SIG, null=False, on_delete=models.CASCADE)
term_start = models.DateField(default=datetime.now(), null=False)
term_end = models.DateField(null=True)


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

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)
term_start = models.DateField(default=datetime.now(), null=False)
term_end = models.DateField(null=True)
4 changes: 4 additions & 0 deletions corpus/corpus/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from django.contrib import admin
from django.urls import include
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
path("admin/", admin.site.urls),
Expand All @@ -28,3 +30,5 @@
path("skyward_expedition/", include("skyward_expedition.urls")),
path("robotrix/", include("robotrix.urls")),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
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"),
]
129 changes: 128 additions & 1 deletion corpus/pages/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from config.models import SIG
from config.models import Society
from accounts.models import Core
from accounts.models import Faculty
from accounts.models import ExecutiveMember
from django.shortcuts import get_object_or_404
from django.shortcuts import render

from django.db.models import Q
from django.db.models import Case, When, Value, CharField

def index(request):
# Get all societies to render on landing page Societies section
Expand Down Expand Up @@ -41,3 +45,126 @@ def sig(request, sig_name):
}

return render(request, "pages/sig.html", args)


def team(request):
members = ExecutiveMember.objects.filter(
Q(user__core__isnull=True) | Q(user__core=None)
)
ieee_core_posts = [
"Convenor",
"Chairperson",
"Vice Chairperson",
"Secretary",
"Joint Secretary",
"Treasurer(Branch)",
"Treasurer(Institute)",
"Webmaster",
"Media Lead",
"Outreach Lead",
"Envision Lead",
"Labs Lead",
]


compsoc_core_posts = [
"CompSoc Chair",
"CompSoc Vice Chair",
"CompSoc Secretary",
"CompSoc Project Head",
"CompSoc Project Coordinator",
"CIS Chair",
"CIS Secretary",
"CIS Project Head",

]

diode_core_posts = [
"Diode Chair",
"SPS Chair",
"SPS Vice Chair",
"SPS Secretary",
"CAS Chair",
"CAS Vice Chair",
"CAS Secretary",
"RAS Chair",
"RAS Secretary",
]

piston_core_posts = [
"Piston Chair",
"Piston Vice Chair",
"Piston Secretary",
"Piston Project Head",
"IAS Chair",
"IAS Secretary",
]

ieee_core = Core.objects.filter(post__in=ieee_core_posts).order_by(
Case(
When(post="Convenor", then=Value(1)),
When(post="Chairperson", then=Value(2)),
When(post="Vice Chairperson", then=Value(3)),
When(post="Secretary", then=Value(4)),
When(post="Joint Secretary", then=Value(5)),
When(post="Treasurer(Branch)", then=Value(6)),
When(post="Treasurer(Institute)", then=Value(7)),
When(post="Webmaster", then=Value(8)),
When(post="Media Lead", then=Value(9)),
When(post="Outreach Lead", then=Value(10)),
When(post="Envision Lead", then=Value(11)),
When(post="Labs Lead", then=Value(12)),
When(post="WiE Chair", then=Value(13)),
)
)

compsoc_core = Core.objects.filter(post__in=compsoc_core_posts).order_by(
Case(
When(post="CompSoc Chair", then=Value(1)),
When(post="CompSoc Vice Chair", then=Value(2)),
When(post="CompSoc Secretary", then=Value(3)),
When(post="CompSoc Project Head", then=Value(4)),
When(post="CompSoc Project Coordinator", then=Value(5)),
When(post="CIS Chair", then=Value(6)),
When(post="CIS Secretary", then=Value(7)),
When(post="CIS Project Head", then=Value(8)),
When(post="Webmaster", then=Value(9)),
)
)

diode_core = Core.objects.filter(post__in=diode_core_posts).order_by(
Case(
When(post="Diode Chair", then=Value(1)),
When(post="SPS Chair", then=Value(2)),
When(post="SPS Vice Chair", then=Value(3)),
When(post="SPS Secretary", then=Value(4)),
When(post="CAS Chair", then=Value(5)),
When(post="CAS Vice Chair", then=Value(6)),
When(post="CAS Secretary", then=Value(7)),
When(post="RAS Chair", then=Value(8)),
When(post="RAS Secretary", then=Value(9)),
)
)

piston_core = Core.objects.filter(post__in=piston_core_posts).order_by(
Case(
When(post="Piston Chair", then=Value(1)),
When(post="Piston Vice Chair", then=Value(2)),
When(post="Piston Secretary", then=Value(3)),
When(post="Piston Project Head", then=Value(4)),
When(post="IAS Chair", then=Value(5)),
When(post="IAS Secretary", then=Value(6)),
)
)


faculty = Faculty.objects.all()
context = {
"members":members,
"ieee_core": ieee_core,
"compsoc_core":compsoc_core,
"diode_core":diode_core,
"piston_core":piston_core,
"faculty":faculty,
}
return render(request, "pages/team.html", context)
1 change: 1 addition & 0 deletions corpus/templates/components/navbar_large.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<div class="navbar-center">
<a href="{% url 'index' %}" class="btn btn-ghost normal-case text-lg">Home</a>
<a href="{% url 'about_us' %}" class="btn btn-ghost normal-case text-lg">About Us</a>
<a href="{% url 'team'%}" class="btn btn-ghost normal-case text-lg"> Team </a>
<div class="dropdown">
<label tabindex="0" class="btn btn-ghost normal-case text-lg">
SIGs
Expand Down
Loading
Loading