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

Migrating pages #68

Merged
merged 48 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
849dbc4
Added Model for SIGs
imApoorva36 Dec 17, 2023
ed10b9d
Added model for SIGs
imApoorva36 Dec 18, 2023
990b1bc
Modified SIG Model and configured django-admin for it and made basic …
imApoorva36 Dec 19, 2023
959b9ac
Added changes and modifies sig.html
imApoorva36 Dec 19, 2023
b01dcf1
Modified minor changes and styling changed
imApoorva36 Dec 20, 2023
ef6e3df
Merge branch 'IEEE-NITK:main' into main
imApoorva36 Dec 20, 2023
55d9af3
Merge branch 'main' into migrating-pages
imApoorva36 Dec 20, 2023
1bb8906
Added hrefs for SIGs
imApoorva36 Dec 20, 2023
4f73975
Merge branch 'migrating-pages' of https://github.com/imApoorva36/corp…
imApoorva36 Dec 20, 2023
d430d7e
Modified minor changes and styling changed and urls modified to avoid…
imApoorva36 Dec 20, 2023
e91275c
removed learn more button
imApoorva36 Dec 20, 2023
85d6e92
Merge branch 'IEEE-NITK:main' into migrating-pages
imApoorva36 Dec 20, 2023
2757559
Added Model for SIGs
imApoorva36 Dec 17, 2023
424ef51
Modified SIG Model and configured django-admin for it and made basic …
imApoorva36 Dec 19, 2023
1daf5d8
Added changes and modifies sig.html
imApoorva36 Dec 19, 2023
927c654
Modified minor changes and styling changed
imApoorva36 Dec 20, 2023
b643e34
Added hrefs for SIGs
imApoorva36 Dec 20, 2023
686b45b
Modified minor changes and styling changed and urls modified to avoid…
imApoorva36 Dec 20, 2023
9df99cf
removed learn more button
imApoorva36 Dec 20, 2023
aacfb66
PR cleanup
anirudhprabhakaran3 Dec 21, 2023
031fa8c
Merge branch 'main' into migrating-pages
imApoorva36 Dec 21, 2023
51786fd
Merge branch 'migrating-pages' of https://github.com/imApoorva36/corp…
imApoorva36 Dec 21, 2023
d5247c1
Merge branch 'IEEE-NITK:main' into migrating-pages
imApoorva36 Dec 21, 2023
36dabc3
Final Set of All Changes for Sig pages with all necessary additions a…
imApoorva36 Dec 21, 2023
885c64c
Fixed models, added slug field and refined migration files
imApoorva36 Dec 22, 2023
0e380a9
Commit so that db gets added
imApoorva36 Dec 22, 2023
099b430
Added minor fixes
imApoorva36 Dec 23, 2023
a4940a4
Minor changes
imApoorva36 Dec 24, 2023
11252b6
Merge branch 'main' into migrating-pages
imApoorva36 Dec 29, 2023
9310ffd
Added SIG Links in footer and added config_db dump
imApoorva36 Dec 29, 2023
a42b630
Modified Navbar and it's various components accordingly
imApoorva36 Dec 29, 2023
4393d58
Minor Changes Resolving sizes and optimisation
imApoorva36 Dec 29, 2023
07b1f81
Modified SIGs data
imApoorva36 Jan 2, 2024
4d90733
Modified config_db file to proper json format
imApoorva36 Jan 2, 2024
c5c097e
Merge branch 'main' of https://github.com/imApoorva36/corpus into mig…
imApoorva36 Jan 14, 2024
730181b
Merge remote-tracking branch 'upstream/main' into migrating-pages
imApoorva36 Jan 14, 2024
861c4a0
Added Diode content and fixed sig pages display issues
imApoorva36 Jan 14, 2024
81068a5
Added Impulse to Navbar
imApoorva36 Jan 14, 2024
d236512
Merge branch 'main' into migrating-pages
nishant-nayak Jan 15, 2024
cfd1549
Small Changes
imApoorva36 Jan 15, 2024
58d30b4
Merge branch 'migrating-pages' of https://github.com/imApoorva36/corp…
imApoorva36 Jan 15, 2024
69b79c2
Merge branch 'main' into migrating-pages
imApoorva36 Jan 19, 2024
89b9f5a
made navbar responsive and resolved sig pages UI Changes
imApoorva36 Jan 19, 2024
e99016d
Merge branch 'migrating-pages' of https://github.com/imApoorva36/corp…
imApoorva36 Jan 19, 2024
5068180
fixed 0004_migration file repititive code
imApoorva36 Jan 19, 2024
f4feb69
fixed sig logo issues and fixed small navbar
imApoorva36 Jan 20, 2024
b877e4a
Merge branch 'main' into migrating-pages
imApoorva36 Jan 20, 2024
2395af6
Update corpus/templates/pages/sig.html
nishant-nayak Jan 21, 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
7 changes: 7 additions & 0 deletions corpus/config/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.contrib import admin

from .models import ModuleConfiguration
from .models import SIG
from .models import Society


Expand All @@ -10,5 +11,11 @@ class SocietyAdmin(admin.ModelAdmin):
list_display_links = ("name",)


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


admin.site.register(Society, SocietyAdmin)
admin.site.register(ModuleConfiguration)
admin.site.register(SIG, SIGAdmin)
43 changes: 43 additions & 0 deletions corpus/config/migrations/0004_sig_society_sigs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Generated by Django 4.2.4 on 2023-12-22 08:12
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

dependencies = [
("config", "0003_moduleconfiguration"),
]

operations = [
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")),
("slug", models.SlugField(null=True, unique=True)),
],
options={
"verbose_name": "SIG",
"verbose_name_plural": "SIGs",
},
),
migrations.AddField(
model_name="society",
name="sigs",
field=models.ManyToManyField(related_name="societies", to="config.sig"),
),
]
20 changes: 20 additions & 0 deletions corpus/config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@
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="")
slug = models.SlugField(unique=True, null=True) # Added SlugField for url access

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 +80,7 @@ class Society(models.Model):
verbose_name="Dark Image", upload_to="img/logo/", blank=True, null=True
)
description = models.TextField(verbose_name="Description")
sigs = models.ManyToManyField(SIG, related_name="societies")

def __str__(self):
return self.get_name_display()
Expand Down
2 changes: 1 addition & 1 deletion corpus/corpus/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

urlpatterns = [
path("admin/", admin.site.urls),
path("", include("pages.urls")),
path("accounts/", include("accounts.urls")),
path("", include("pages.urls")),
path("embedathon/", include("embedathon.urls")),
]
12 changes: 5 additions & 7 deletions corpus/pages/urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from django.urls import path

from .views import about_us
from .views import index
from .views import impulse
from pages import views

urlpatterns = [
path("", index, name="index"),
path("about_us/", about_us, name="about_us"),
path('impulse', impulse, name='impulse'),
path("", views.index, name="index"),
path("about_us/", views.about_us, name="about_us"),
path("impulse", views.impulse, name="impulse"),
path("sig/<str:sig_slug>/", views.sig, name="sig"),
]
19 changes: 18 additions & 1 deletion corpus/pages/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from config.models import SIG
from config.models import Society
from django.shortcuts import get_object_or_404
from django.shortcuts import render


Expand Down Expand Up @@ -26,9 +28,24 @@ def about_us(request):
},
)


def impulse(request):

return render(
request,
"pages/impulse.html",
)
)


def sig(request, sig_slug):
sig_data = get_object_or_404(SIG, slug=sig_slug)

# Retrieve the related society details using the SIG instance
societies_linked_to_sig = sig_data.societies.all()

args = {
"sig": sig_data,
"societies_linked_to_sig": societies_linked_to_sig,
}

return render(request, "pages/sig.html", args)
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="#" 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="#" 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="#" 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
57 changes: 57 additions & 0 deletions corpus/templates/pages/sig.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% extends 'base.html' %}
{% load static %}

{% block title %}
Home
{% endblock %}

{% block style %}
<link rel="stylesheet" href="{% static 'css/index.css' %}" />
{% endblock %}

{% block content %}
<!-- Hero Section -->
<!-- TODO: Add action button -->
<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 style="gap: 20px; justify-content: space-between; margin: auto;">
{% for society in societies_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 -->
<section class="bg-base-100 text-center prose px-10 lg:px-40 py-10 min-w-full">
<h1 class="text-4xl lg:text-5xl">About {{sig.name}}</h1>
<p class="text-justify">
{{sig.about}}
</p>
</section>
<!-- SIG Section -->
<!-- TODO: Add SIG Links -->
<section class="bg-base-200 text-center prose px-10 lg:px-40 py-10 min-w-full">
<div class="flex gap-8 justify-center not-prose lg:flex-row flex-col">
<div class="card bg-base-100 shadow-xl basis-2/3">
<div class="card-body items-center text-center">
<h2 class="card-title my-4 text-4xl">What We Do</h2>
<p>{{sig.what_we_do}}</p>
</div>
</div>
</div>
</section>
{% endblock %}

{% block script %}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/particles.min.js"></script>
<script src="https://unpkg.com/typeit"></script>
<script src="{% static 'js/index.js' %}"></script>
{% endblock %}