Skip to content

Commit

Permalink
Final Set of All Changes for Sig pages with all necessary additions a…
Browse files Browse the repository at this point in the history
…nd code fixes
  • Loading branch information
imApoorva36 committed Dec 21, 2023
1 parent d5247c1 commit 36dabc3
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 34 deletions.
2 changes: 1 addition & 1 deletion corpus/config/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SocietyAdmin(admin.ModelAdmin):


class SIGAdmin(admin.ModelAdmin):
list_display = ("id", "name", "about", "what_we_do")
list_display = ("id", "name")
list_display_links = ("name",)


Expand Down
148 changes: 148 additions & 0 deletions corpus/config/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Generated by Django 4.2.4 on 2023-12-21 19:49
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

initial = True

dependencies = []

operations = [
migrations.CreateModel(
name="ModuleConfiguration",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("module_name", models.CharField(max_length=200)),
("module_enabled", models.BooleanField(default=False)),
("module_config", models.JSONField()),
],
),
migrations.CreateModel(
name="SIG",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"name",
models.CharField(max_length=10, unique=True, verbose_name="Name"),
),
("about", models.TextField(default="", verbose_name="About Us")),
("what_we_do", models.TextField(default="", verbose_name="What We Do")),
],
options={
"verbose_name": "SIG",
"verbose_name_plural": "SIGs",
},
),
migrations.CreateModel(
name="Society",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"name",
models.CharField(
choices=[
("AESS", "Aerospace and Electronic Systems Society"),
("APS", "Antennas and Propagation Society"),
("BTS", "Broadcast Technology Society"),
("CASS", "Circuits and Systems Society"),
("COM", "Communications Society"),
("CIS", "Computational Intelligence Society"),
("CS", "Computer Society"),
("CTS", "Consumer Technology Society"),
("CSS", "Control Systems Society"),
("DEIS", "Dielectrics and Electrical Insulation Society"),
("ES", "Education Society"),
("ECS", "Electromagnetic Compatibility Society"),
("EDS", "Electron Devices Society"),
("EPS", "Electronics Packing Society"),
("EMBS", "Engineering in Medicine and Biology Society"),
("GRSS", "Geoscience and Remote Sensing Society"),
("IES", "Industrial Electronics Society"),
("IAS", "Industry Applications Society"),
("ITS", "Information Theory Society"),
("IMS", "Instrumentation and Measurement Society"),
("ITSS", "Intelligent Transportation Systems Society"),
("MS", "Magnetics Society"),
("MTTS", "Microwave Theory and Technology Society"),
("NPSS", "Nuclear and Plasma Sciences Society"),
("OES", "Oceanic Engineering Society"),
("PHO", "Photonics Society"),
("PELS", "Power Electronics Society"),
("PES", "Power and Energy Society"),
("PSES", "Product Safety Engineering Society"),
("PCS", "Professional Communication Society"),
("RS", "Reliability Society"),
("RAS", "Robotics and Automation Society"),
("SPS", "Signal Processing Society"),
("SSIT", "Society on Social Implications of Technology"),
("SSCS", "Solid-State Circuits Society"),
("SMCS", "Systems, Man, and Cybernetics Society"),
("TEMS", "Technology and Engineering Management Society"),
(
"UFFCS",
"Ultrasonics, Ferroelectrics, and Frequency Control Society",
),
("VT", "Vehicular Technology Society"),
(
"SIGHT",
"Special Interest Group on Humanitarian Technology",
),
("WIE", "Women in Engineering"),
],
max_length=5,
unique=True,
verbose_name="Name",
),
),
("url", models.URLField(unique=True, verbose_name="URL")),
(
"image",
models.ImageField(upload_to="img/logo/", verbose_name="Image"),
),
(
"dark_image",
models.ImageField(
blank=True,
null=True,
upload_to="img/logo/",
verbose_name="Dark Image",
),
),
("description", models.TextField(verbose_name="Description")),
(
"sig",
models.IntegerField(default=-1, null=True, verbose_name="SIG ID"),
),
],
options={
"verbose_name": "Society",
"verbose_name_plural": "Societies",
},
),
]
Empty file.
37 changes: 19 additions & 18 deletions corpus/config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
DATETIME_FORMAT = "%d-%m-%Y %H:%M:%S"


class SIG(models.Model):
"""
SIG Model.
Defines all sigs that are part of IEEE NITK SB.
"""

name = models.CharField(verbose_name="Name", max_length=10, unique=True)
about = models.TextField(verbose_name="About Us", default="")
what_we_do = models.TextField(verbose_name="What We Do", default="")

def __str__(self):
return self.name

class Meta:
verbose_name = "SIG"
verbose_name_plural = "SIGs"


class Society(models.Model):
"""
Society Model.
Expand Down Expand Up @@ -61,6 +79,7 @@ class Society(models.Model):
verbose_name="Dark Image", upload_to="img/logo/", blank=True, null=True
)
description = models.TextField(verbose_name="Description")
sig = models.IntegerField(verbose_name="SIG ID", default=-1, null=True)

def __str__(self):
return self.get_name_display()
Expand All @@ -70,24 +89,6 @@ class Meta:
verbose_name_plural = "Societies"


class SIG(models.Model):
"""
SIG Model.
Defines all sigs that are part of IEEE NITK SB.
"""

name = models.CharField(verbose_name="Name", max_length=10, unique=True)
about = models.TextField(verbose_name="About Us", default="")
what_we_do = models.TextField(verbose_name="What We Do", default="")

def __str__(self):
return self.name

class Meta:
verbose_name = "SIG"
verbose_name_plural = "SIGs"


class ModuleConfiguration(models.Model):
module_name = models.CharField(max_length=200, blank=False, null=False)
module_enabled = models.BooleanField(default=False)
Expand Down
4 changes: 0 additions & 4 deletions corpus/corpus/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,4 @@
path("accounts/", include("accounts.urls")),
path("", include("pages.urls")),
path("embedathon/", include("embedathon.urls")),
path(
"", include("pages.urls")
), # This is after other urls so that "<str:sig_name>/""
# doesn't prevent other urls such as embedathon from loading
]
10 changes: 8 additions & 2 deletions corpus/pages/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ def impulse(request):


def sig(request, sig_name):
sig = get_object_or_404(SIG, name=sig_name)
sig_data = get_object_or_404(SIG, name=sig_name)

# Retrieve the related society details using the SIG instance
society_linked_to_sig = Society.objects.filter(sig=sig_data.id)

return render(
request,
"pages/sig.html",
{
"sig": sig,
"sig": sig_data,
# Pass the society details to the SIG
"society_linked_to_sig": society_linked_to_sig,
},
)
6 changes: 3 additions & 3 deletions corpus/templates/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h2 class="card-title my-4 text-3xl">CompSoc</h2>
<p>A conglomeration of students with a passion for Computer Science, Information Technology and
Artificial Intelligence</p>
<div class="card-actions mt-3">
<a role="button" href="CompSoc/" class="btn btn-outline btn-primary">Learn More</a>
<a role="button" href="sig/CompSoc/" class="btn btn-outline btn-primary">Learn More</a>
</div>
</div>
</div>
Expand All @@ -76,7 +76,7 @@ <h2 class="card-title my-4 text-3xl">Diode</h2>
<p>A special interest group with a strong interest in the field of Electronics and Electrical Science
</p>
<div class="card-actions mt-3">
<a role="button" href="Diode/" class="btn btn-outline btn-primary">Learn More</a>
<a role="button" href="sig/Diode/" class="btn btn-outline btn-primary">Learn More</a>
</div>
</div>
</div>
Expand All @@ -95,7 +95,7 @@ <h2 class="card-title my-4 text-3xl">Piston</h2>
<p>A team dedicated to the engineering applications of Mechanical, Automation, Civil, Chemical and
Material Sciences</p>
<div class="card-actions mt-3">
<a role="button" href="Piston/" class="btn btn-outline btn-primary">Learn More</a>
<a role="button" href="sig/Piston/" class="btn btn-outline btn-primary">Learn More</a>
</div>
</div>
</div>
Expand Down
17 changes: 11 additions & 6 deletions corpus/templates/pages/sig.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
<section
class="hero min-h-screen min-w-screen bg-gradient-to-br from-sky-50 to-blue-300 dark:from-blue-950 dark:to-base-100">
<div id="particles-js" class="h-screen w-full"></div>
<div class="hero-content text-center flex-col">
<a class="my-5" href="https://www.computer.org/">
<img class="w-40 md:w-max" style="display: none ;" src="{% static 'img/logo/compsoc-light.png' %}" id="ieee-blue"
alt="CompSoc Logo">
<img class="w-40 md:w-max" style="display: none;" src="{% static 'img/logo/compsoc-dark.png' %}" id="ieee-white"
alt="CompSoc Logo">
<div style="gap: 20px; justify-content: space-between; margin: auto;">
{% for society in society_linked_to_sig %}
<a class="my-5" href="{{society.url}}">
{% if society.dark_image %}
<img src="{% static '/' %}{{ society.image }}" style="display: none; padding: 10px; height: 250px; width: auto;" alt="{{ society.name }} Logo" class="light-logo h-14 lg:h-24 inline" >
<img src="{% static '/' %}{{ society.dark_image }}" style="display: none; padding: 10px; height: 250px; width: auto;" alt="{{ society.name }} Logo" class="dark-logo h-14 lg:h-24 inline">
{% else %}
<img src="{% static '/' %}{{ society.image }}" style="display: none; padding: 10px; height:250px; width: auto;" alt="{{ society.name }} Logo" class="light-logo h-14 lg:h-24 inline" >
{% endif %}
</a>
{% empty %}
{% endfor %}
</div>
</section>
<!-- About SIG Section -->
Expand Down

0 comments on commit 36dabc3

Please sign in to comment.