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

Embedathon home #65

Closed
wants to merge 12 commits into from
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", "about", "what_we_do")
list_display_links = ("name",)


admin.site.register(Society, SocietyAdmin)
admin.site.register(ModuleConfiguration)
admin.site.register(SIG, SIGAdmin)
26 changes: 26 additions & 0 deletions corpus/config/migrations/0004_sig.py
Original file line number Diff line number Diff line change
@@ -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',
},
),
]
20 changes: 20 additions & 0 deletions corpus/config/migrations/0005_sig_sigimg.py
Original file line number Diff line number Diff line change
@@ -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"
),
),
]
Original file line number Diff line number Diff line change
@@ -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"),
),
]
Original file line number Diff line number Diff line change
@@ -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",
),
]
29 changes: 29 additions & 0 deletions corpus/config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,35 @@ 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):
"""
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)
Expand Down
4 changes: 3 additions & 1 deletion corpus/corpus/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
),
]
3 changes: 3 additions & 0 deletions corpus/pages/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

from .views import about_us
from .views import index
from .views import sig
from .views import impulse
from .views import embedathon

urlpatterns = [
path("", index, name="index"),
path("about_us/", about_us, name="about_us"),
path("<str:sig_name>/", sig, name="sig"),
path('impulse', impulse, name='impulse'),
]
17 changes: 16 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,22 @@ def about_us(request):
},
)

def sig(request, sig_name):
sig = get_object_or_404(SIG, name=sig_name)
return render(
request,
"pages/sig.html",
{
"sig": sig,
},
)

def embedathon(request):
return render(request, "templates/embedathon/home.html")

def impulse(request):

return render(
request,
"pages/impulse.html",
)
)
2 changes: 1 addition & 1 deletion corpus/templates/embedathon/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ <h2>FAQs</h2>
Will students be given participation certificates for the event?
</div>
<div class="collapse-content">
<p>Yes! Participation certificates will be given to students who clear round 1.</p>
<p> Yes! Participation certificates will be given to students who clear round 1.</p>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion 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="CompSoc/" class="btn btn-outline btn-primary">Learn More</a>
</div>
</div>
</div>
Expand Down