From 849dbc41585397370d4fea121309a6ed76c4deb2 Mon Sep 17 00:00:00 2001 From: Testing wala User Date: Mon, 18 Dec 2023 00:44:26 +0530 Subject: [PATCH 1/8] Added Model for SIGs --- corpus/config/migrations/0004_sig.py | 26 ++++++++++++++++++++++++++ corpus/config/models.py | 18 ++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 corpus/config/migrations/0004_sig.py diff --git a/corpus/config/migrations/0004_sig.py b/corpus/config/migrations/0004_sig.py new file mode 100644 index 00000000..c80a1276 --- /dev/null +++ b/corpus/config/migrations/0004_sig.py @@ -0,0 +1,26 @@ +# Generated by Django 4.2.3 on 2023-12-17 19:14 + +from django.db import migrations, 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(choices=[('CompSoc', 'CompSoc'), ('Diode', 'Diode'), ('Piston', 'Piston'), ('WiE', 'WiE'), ('SIGHT', 'SIGHT')], max_length=10, unique=True, verbose_name='Name')), + ('aboutus', models.CharField(verbose_name='AboutUs')), + ('whatwedo', models.CharField(verbose_name='WhatWeDo')), + ], + options={ + 'verbose_name': 'SIG', + 'verbose_name_plural': 'SIGs', + }, + ), + ] diff --git a/corpus/config/models.py b/corpus/config/models.py index a5eb9722..b9cf74bb 100644 --- a/corpus/config/models.py +++ b/corpus/config/models.py @@ -69,6 +69,24 @@ class Meta: verbose_name = "Society" verbose_name_plural = "Societies" +class SIG(models.Model): + IEEE_SIGs=[ + ("CompSoc","CompSoc"), + ("Diode","Diode"), + ("Piston","Piston"), + ("WiE","WiE"), + ("SIGHT","SIGHT"), + ] + name = models.CharField(verbose_name="Name", max_length=10, unique=True, choices=IEEE_SIGs) + aboutus=models.CharField(verbose_name="AboutUs") + whatwedo=models.CharField(verbose_name="WhatWeDo") + + def __str__(self): + return self.get_name_display() + + class Meta: + verbose_name = "SIG" + verbose_name_plural = "SIGs" class ModuleConfiguration(models.Model): module_name = models.CharField(max_length=200, blank=False, null=False) From 990b1bc883d6939d3cbee0487bde770daf83f156 Mon Sep 17 00:00:00 2001 From: Testing wala User Date: Tue, 19 Dec 2023 13:44:20 +0530 Subject: [PATCH 2/8] Modified SIG Model and configured django-admin for it and made basic sig.html --- corpus/config/admin.py | 7 ++ corpus/config/migrations/0005_sig_sigimg.py | 20 ++++++ ..._sig_aboutus_remove_sig_sigimg_and_more.py | 47 +++++++++++++ ...e_about_us_sig_about_remove_sig_sig_img.py | 21 ++++++ corpus/config/models.py | 22 +++--- corpus/pages/urls.py | 2 + corpus/pages/views.py | 13 ++++ corpus/templates/pages/index.html | 2 +- corpus/templates/pages/sig.html | 67 +++++++++++++++++++ 9 files changed, 189 insertions(+), 12 deletions(-) create mode 100644 corpus/config/migrations/0005_sig_sigimg.py create mode 100644 corpus/config/migrations/0006_remove_sig_aboutus_remove_sig_sigimg_and_more.py create mode 100644 corpus/config/migrations/0007_rename_about_us_sig_about_remove_sig_sig_img.py create mode 100644 corpus/templates/pages/sig.html diff --git a/corpus/config/admin.py b/corpus/config/admin.py index e4263045..3790d3a8 100644 --- a/corpus/config/admin.py +++ b/corpus/config/admin.py @@ -1,6 +1,7 @@ from django.contrib import admin from .models import ModuleConfiguration +from .models import SIG from .models import Society @@ -10,5 +11,11 @@ class SocietyAdmin(admin.ModelAdmin): list_display_links = ("name",) +class SIGAdmin(admin.ModelAdmin): + list_display = ("id", "name", "about", "what_we_do") + list_display_links = ("name",) + + admin.site.register(Society, SocietyAdmin) admin.site.register(ModuleConfiguration) +admin.site.register(SIG, SIGAdmin) diff --git a/corpus/config/migrations/0005_sig_sigimg.py b/corpus/config/migrations/0005_sig_sigimg.py new file mode 100644 index 00000000..9c4370c6 --- /dev/null +++ b/corpus/config/migrations/0005_sig_sigimg.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.4 on 2023-12-18 16:01 +from django.db import migrations +from django.db import models + + +class Migration(migrations.Migration): + + dependencies = [ + ("config", "0004_sig"), + ] + + operations = [ + migrations.AddField( + model_name="sig", + name="sigimg", + field=models.ImageField( + blank=True, null=True, upload_to="img/logo/", verbose_name="SIGImage" + ), + ), + ] diff --git a/corpus/config/migrations/0006_remove_sig_aboutus_remove_sig_sigimg_and_more.py b/corpus/config/migrations/0006_remove_sig_aboutus_remove_sig_sigimg_and_more.py new file mode 100644 index 00000000..09e6bdff --- /dev/null +++ b/corpus/config/migrations/0006_remove_sig_aboutus_remove_sig_sigimg_and_more.py @@ -0,0 +1,47 @@ +# Generated by Django 4.2.4 on 2023-12-19 06:24 +from django.db import migrations +from django.db import models + + +class Migration(migrations.Migration): + + dependencies = [ + ("config", "0005_sig_sigimg"), + ] + + operations = [ + migrations.RemoveField( + model_name="sig", + name="aboutus", + ), + migrations.RemoveField( + model_name="sig", + name="sigimg", + ), + migrations.RemoveField( + model_name="sig", + name="whatwedo", + ), + migrations.AddField( + model_name="sig", + name="about_us", + field=models.CharField(default="", verbose_name="About Us"), + ), + migrations.AddField( + model_name="sig", + name="sig_img", + field=models.ImageField( + blank=True, null=True, upload_to="img/logo/", verbose_name="SIG Image" + ), + ), + migrations.AddField( + model_name="sig", + name="what_we_do", + field=models.CharField(default="", verbose_name="What We Do"), + ), + migrations.AlterField( + model_name="sig", + name="name", + field=models.CharField(max_length=10, unique=True, verbose_name="Name"), + ), + ] diff --git a/corpus/config/migrations/0007_rename_about_us_sig_about_remove_sig_sig_img.py b/corpus/config/migrations/0007_rename_about_us_sig_about_remove_sig_sig_img.py new file mode 100644 index 00000000..203b2057 --- /dev/null +++ b/corpus/config/migrations/0007_rename_about_us_sig_about_remove_sig_sig_img.py @@ -0,0 +1,21 @@ +# Generated by Django 4.2.4 on 2023-12-19 06:33 +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("config", "0006_remove_sig_aboutus_remove_sig_sigimg_and_more"), + ] + + operations = [ + migrations.RenameField( + model_name="sig", + old_name="about_us", + new_name="about", + ), + migrations.RemoveField( + model_name="sig", + name="sig_img", + ), + ] diff --git a/corpus/config/models.py b/corpus/config/models.py index b9cf74bb..7cbf05c6 100644 --- a/corpus/config/models.py +++ b/corpus/config/models.py @@ -69,25 +69,25 @@ class Meta: verbose_name = "Society" verbose_name_plural = "Societies" + class SIG(models.Model): - IEEE_SIGs=[ - ("CompSoc","CompSoc"), - ("Diode","Diode"), - ("Piston","Piston"), - ("WiE","WiE"), - ("SIGHT","SIGHT"), - ] - name = models.CharField(verbose_name="Name", max_length=10, unique=True, choices=IEEE_SIGs) - aboutus=models.CharField(verbose_name="AboutUs") - whatwedo=models.CharField(verbose_name="WhatWeDo") + """ + 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.CharField(verbose_name="About Us", default="") + what_we_do = models.CharField(verbose_name="What We Do", default="") def __str__(self): - return self.get_name_display() + 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) diff --git a/corpus/pages/urls.py b/corpus/pages/urls.py index 80eb0c1b..78ab6461 100644 --- a/corpus/pages/urls.py +++ b/corpus/pages/urls.py @@ -1,9 +1,11 @@ from django.urls import path from .views import about_us +from .views import compsoc from .views import index urlpatterns = [ path("", index, name="index"), path("about_us/", about_us, name="about_us"), + path("compsoc/", compsoc, name="compsoc"), ] diff --git a/corpus/pages/views.py b/corpus/pages/views.py index 364ddf0b..de597c2b 100644 --- a/corpus/pages/views.py +++ b/corpus/pages/views.py @@ -1,3 +1,4 @@ +from config.models import SIG from config.models import Society from django.shortcuts import render @@ -25,3 +26,15 @@ def about_us(request): "socieites": societies, }, ) + + +def compsoc(request): + sigs = SIG.objects.all() + + return render( + request, + "pages/sig.html", + { + "sigs": sigs, + }, + ) diff --git a/corpus/templates/pages/index.html b/corpus/templates/pages/index.html index b086a954..44389b9a 100644 --- a/corpus/templates/pages/index.html +++ b/corpus/templates/pages/index.html @@ -60,7 +60,7 @@

CompSoc

A conglomeration of students with a passion for Computer Science, Information Technology and Artificial Intelligence

diff --git a/corpus/templates/pages/sig.html b/corpus/templates/pages/sig.html new file mode 100644 index 00000000..163c205c --- /dev/null +++ b/corpus/templates/pages/sig.html @@ -0,0 +1,67 @@ +{% extends 'base.html' %} +{% load static %} + +{% block title %} +Home +{% endblock %} + +{% block style %} + +{% endblock %} + +{% block content %} + + +
+
+ +
+ +
+ {% for sig in sigs %} +

About {{sig.name}}

+

+ {{sig.about}} +

+ {% endfor %} +
+ + +
+

What We Do

+
+ {% for sig in sigs %} +
+
+
+ + + +
+

CompSoc

+

{{sig.what_we_do}}

+ +
+
+ {% endfor %} +
+
+{% endblock %} + +{% block script %} + + + +{% endblock %} From 959b9ac9200879154e02cee254ea5d376cdef4f5 Mon Sep 17 00:00:00 2001 From: Testing wala User Date: Tue, 19 Dec 2023 23:21:23 +0530 Subject: [PATCH 3/8] Added changes and modifies sig.html --- corpus/config/models.py | 4 ++-- corpus/pages/urls.py | 4 ++-- corpus/pages/views.py | 11 +++++---- corpus/templates/pages/index.html | 2 +- corpus/templates/pages/sig.html | 40 ++++++++++++++----------------- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/corpus/config/models.py b/corpus/config/models.py index 7cbf05c6..c0ec4da3 100644 --- a/corpus/config/models.py +++ b/corpus/config/models.py @@ -77,8 +77,8 @@ class SIG(models.Model): """ name = models.CharField(verbose_name="Name", max_length=10, unique=True) - about = models.CharField(verbose_name="About Us", default="") - what_we_do = models.CharField(verbose_name="What We Do", default="") + 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 diff --git a/corpus/pages/urls.py b/corpus/pages/urls.py index 78ab6461..676d7abd 100644 --- a/corpus/pages/urls.py +++ b/corpus/pages/urls.py @@ -1,11 +1,11 @@ from django.urls import path from .views import about_us -from .views import compsoc from .views import index +from .views import sig urlpatterns = [ path("", index, name="index"), path("about_us/", about_us, name="about_us"), - path("compsoc/", compsoc, name="compsoc"), + path("/", sig, name="sig"), ] diff --git a/corpus/pages/views.py b/corpus/pages/views.py index de597c2b..dfc6ab00 100644 --- a/corpus/pages/views.py +++ b/corpus/pages/views.py @@ -1,5 +1,6 @@ from config.models import SIG from config.models import Society +from django.shortcuts import redirect from django.shortcuts import render @@ -28,13 +29,15 @@ def about_us(request): ) -def compsoc(request): - sigs = SIG.objects.all() - +def sig(request, sig_name): + try: + sig = SIG.objects.get(name=sig_name) + except SIG.DoesNotExist: + return redirect("index") return render( request, "pages/sig.html", { - "sigs": sigs, + "sig": sig, }, ) diff --git a/corpus/templates/pages/index.html b/corpus/templates/pages/index.html index 44389b9a..5a6c7507 100644 --- a/corpus/templates/pages/index.html +++ b/corpus/templates/pages/index.html @@ -60,7 +60,7 @@

CompSoc

A conglomeration of students with a passion for Computer Science, Information Technology and Artificial Intelligence

diff --git a/corpus/templates/pages/sig.html b/corpus/templates/pages/sig.html index 163c205c..1bf59b77 100644 --- a/corpus/templates/pages/sig.html +++ b/corpus/templates/pages/sig.html @@ -26,36 +26,32 @@
- {% for sig in sigs %} -

About {{sig.name}}

-

- {{sig.about}} -

- {% endfor %} +

About {{ sig.name }}

+

+ {{sig.about}} +

What We Do

- {% for sig in sigs %} -
-
-
- - - -
-

CompSoc

-

{{sig.what_we_do}}

- +
+
+
+ + + +
+

CompSoc

+

{{sig.what_we_do}}

+
- {% endfor %} +
{% endblock %} From b01dcf142bf532c24b18ba7ea30200257492f359 Mon Sep 17 00:00:00 2001 From: Testing wala User Date: Wed, 20 Dec 2023 17:55:37 +0530 Subject: [PATCH 4/8] Modified minor changes and styling changed --- corpus/pages/views.py | 7 ++----- corpus/templates/pages/sig.html | 12 ++---------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/corpus/pages/views.py b/corpus/pages/views.py index dfc6ab00..3f56356a 100644 --- a/corpus/pages/views.py +++ b/corpus/pages/views.py @@ -1,6 +1,6 @@ from config.models import SIG from config.models import Society -from django.shortcuts import redirect +from django.shortcuts import get_object_or_404 from django.shortcuts import render @@ -30,10 +30,7 @@ def about_us(request): def sig(request, sig_name): - try: - sig = SIG.objects.get(name=sig_name) - except SIG.DoesNotExist: - return redirect("index") + sig = get_object_or_404(SIG, name=sig_name) return render( request, "pages/sig.html", diff --git a/corpus/templates/pages/sig.html b/corpus/templates/pages/sig.html index 1bf59b77..e65d237e 100644 --- a/corpus/templates/pages/sig.html +++ b/corpus/templates/pages/sig.html @@ -34,18 +34,10 @@

About {{ sig.name }}

-

What We Do

-
+
-
- - - -
-

CompSoc

+

What We Do

{{sig.what_we_do}}

Learn More From a4b345672a8a4e002b2e412a4ee7d3b97d4da91e Mon Sep 17 00:00:00 2001 From: ady Date: Thu, 21 Dec 2023 12:07:21 +0530 Subject: [PATCH 5/8] Edited Embedathon homepage and fixed sig.html --- corpus/templates/embedathon/home.html | 2 +- corpus/templates/pages/sig.html | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/corpus/templates/embedathon/home.html b/corpus/templates/embedathon/home.html index 89a50a80..76c286f8 100644 --- a/corpus/templates/embedathon/home.html +++ b/corpus/templates/embedathon/home.html @@ -59,7 +59,7 @@

Light Weight Cryptography for IoT

By P.V. Ananda Mohan Technology Advisor at Center for Development of Advanced Computing (CDAC)
- 3rd Jan, 2024 at 5:00PM + 3rd Jan, 2024 at 6:00PM
diff --git a/corpus/templates/pages/sig.html b/corpus/templates/pages/sig.html index e65d237e..991941ae 100644 --- a/corpus/templates/pages/sig.html +++ b/corpus/templates/pages/sig.html @@ -16,11 +16,11 @@ 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">
From 6e1446e1699e0ff5ace1f8bd900ee31b3f376c7b Mon Sep 17 00:00:00 2001 From: imApoorva36 <90238207+imApoorva36@users.noreply.github.com> Date: Thu, 21 Dec 2023 12:23:51 +0530 Subject: [PATCH 6/8] Delete corpus/templates/pages/sig.html --- corpus/templates/pages/sig.html | 55 --------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 corpus/templates/pages/sig.html diff --git a/corpus/templates/pages/sig.html b/corpus/templates/pages/sig.html deleted file mode 100644 index 991941ae..00000000 --- a/corpus/templates/pages/sig.html +++ /dev/null @@ -1,55 +0,0 @@ -{% extends 'base.html' %} -{% load static %} - -{% block title %} -Home -{% endblock %} - -{% block style %} - -{% endblock %} - -{% block content %} - - -
-
- -
- -
-

About {{ sig.name }}

-

- {{sig.about}} -

-
- - -
-
-
-
-

What We Do

-

{{sig.what_we_do}}

- -
-
-
-
-{% endblock %} - -{% block script %} - - - -{% endblock %} From d67450aef58d5daaf5975d0be34478930313a0af Mon Sep 17 00:00:00 2001 From: ady Date: Thu, 21 Dec 2023 12:44:19 +0530 Subject: [PATCH 7/8] Only time changed --- corpus/templates/embedathon/home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corpus/templates/embedathon/home.html b/corpus/templates/embedathon/home.html index 76c286f8..8e9072a9 100644 --- a/corpus/templates/embedathon/home.html +++ b/corpus/templates/embedathon/home.html @@ -229,7 +229,7 @@

FAQs

Will students be given participation certificates for the event?
-

Yes! Participation certificates will be given to students who clear round 1.

+

Yes! Participation certificates will be given to students who clear round 1.

From eb9d67f0b5d7a0aefaf56b1657dcea5fce1ba65e Mon Sep 17 00:00:00 2001 From: ady Date: Thu, 21 Dec 2023 12:59:27 +0530 Subject: [PATCH 8/8] Changed time to 6:00PM --- corpus/config/models.py | 11 +++++++++++ corpus/corpus/urls.py | 4 +++- corpus/pages/urls.py | 1 + corpus/pages/views.py | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/corpus/config/models.py b/corpus/config/models.py index c0ec4da3..c5baa9bf 100644 --- a/corpus/config/models.py +++ b/corpus/config/models.py @@ -69,6 +69,17 @@ class Meta: verbose_name = "Society" verbose_name_plural = "Societies" +class SIG(models.Model): + IEEE_SIGs=[ + ("CompSoc","CompSoc"), + ("Diode","Diode"), + ("Piston","Piston"), + ("WiE","WiE"), + ("SIGHT","SIGHT"), + ] + name = models.CharField(verbose_name="Name", max_length=10, unique=True, choices=IEEE_SIGs) + aboutus=models.CharField(verbose_name="AboutUs") + whatwedo=models.CharField(verbose_name="WhatWeDo") class SIG(models.Model): """ diff --git a/corpus/corpus/urls.py b/corpus/corpus/urls.py index be087bc3..973b389f 100644 --- a/corpus/corpus/urls.py +++ b/corpus/corpus/urls.py @@ -20,7 +20,9 @@ urlpatterns = [ path("admin/", admin.site.urls), - path("", include("pages.urls")), path("accounts/", include("accounts.urls")), path("embedathon/", include("embedathon.urls")), + path( + "", include("pages.urls") + ), ] diff --git a/corpus/pages/urls.py b/corpus/pages/urls.py index 676d7abd..290177f3 100644 --- a/corpus/pages/urls.py +++ b/corpus/pages/urls.py @@ -3,6 +3,7 @@ from .views import about_us from .views import index from .views import sig +from .views import embedathon urlpatterns = [ path("", index, name="index"), diff --git a/corpus/pages/views.py b/corpus/pages/views.py index 3f56356a..8f051743 100644 --- a/corpus/pages/views.py +++ b/corpus/pages/views.py @@ -38,3 +38,6 @@ def sig(request, sig_name): "sig": sig, }, ) + +def embedathon(request): + return render(request, "templates/embedathon/home.html")