Skip to content

Commit

Permalink
Merge pull request #28 from IEEE-NITK/landing_page
Browse files Browse the repository at this point in the history
Add landing page
  • Loading branch information
anirudhprabhakaran3 authored Sep 18, 2023
2 parents 568cdb0 + e4d94ae commit ef1043e
Show file tree
Hide file tree
Showing 39 changed files with 927 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# End of https://www.toptal.com/developers/gitignore/api/django
# End of https://www.toptal.com/developers/gitignore/api/django
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ repos:
rev: 6.0.0
hooks:
- id: flake8
exclude: migrations/
args:
- --max-line-length=88

Expand Down
Empty file added corpus/config/__init__.py
Empty file.
12 changes: 12 additions & 0 deletions corpus/config/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.contrib import admin

from .models import Society


# Define the fields to be displayed in the admin panel
class SocietyAdmin(admin.ModelAdmin):
list_display = ("id", "name", "url")
list_display_links = ("name",)


admin.site.register(Society, SocietyAdmin)
6 changes: 6 additions & 0 deletions corpus/config/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class ConfigConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "config"
97 changes: 97 additions & 0 deletions corpus/config/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Generated by Django 4.2.4 on 2023-09-10 16:43
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

initial = True

dependencies = []

operations = [
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"),
],
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",
),
),
],
options={
"verbose_name": "Society",
"verbose_name_plural": "Societies",
},
),
]
Empty file.
65 changes: 65 additions & 0 deletions corpus/config/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
from django.db import models


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

IEEE_SOCIETIES = [
("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"),
]
name = models.CharField(
verbose_name="Name", max_length=5, unique=True, choices=IEEE_SOCIETIES
)
url = models.URLField(verbose_name="URL", max_length=200, unique=True)
image = models.ImageField(verbose_name="Image", upload_to="img/logo/")
dark_image = models.ImageField(
verbose_name="Dark Image", upload_to="img/logo/", blank=True, null=True
)

def __str__(self):
return self.get_name_display()

class Meta:
verbose_name = "Society"
verbose_name_plural = "Societies"
2 changes: 2 additions & 0 deletions corpus/config/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# from django.test import TestCase
# Create your tests here.
2 changes: 2 additions & 0 deletions corpus/config/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# from django.shortcuts import render
# Create your views here.
82 changes: 82 additions & 0 deletions corpus/config_db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[
{
"fields": {
"dark_image": "img/logo/compsoc-dark.png",
"image": "img/logo/compsoc-light.png",
"name": "CS",
"url": "https://www.computer.org/"
},
"model": "config.society",
"pk": 1
},
{
"fields": {
"dark_image": "",
"image": "img/logo/sps.png",
"name": "SPS",
"url": "https://signalprocessingsociety.org/"
},
"model": "config.society",
"pk": 2
},
{
"fields": {
"dark_image": "img/logo/cass-dark.png",
"image": "img/logo/cass-light.png",
"name": "CASS",
"url": "https://ieee-cas.org/"
},
"model": "config.society",
"pk": 3
},
{
"fields": {
"dark_image": "img/logo/ias-dark.png",
"image": "img/logo/ias-light.png",
"name": "IAS",
"url": "https://ias.ieee.org/"
},
"model": "config.society",
"pk": 4
},
{
"fields": {
"dark_image": "",
"image": "img/logo/photonics.png",
"name": "PHO",
"url": "https://www.photonicssociety.org/"
},
"model": "config.society",
"pk": 5
},
{
"fields": {
"dark_image": "",
"image": "img/logo/ras.png",
"name": "RAS",
"url": "https://www.ieee-ras.org/"
},
"model": "config.society",
"pk": 6
},
{
"fields": {
"dark_image": "img/logo/grss-dark.png",
"image": "img/logo/grss-light.png",
"name": "GRSS",
"url": "https://www.grss-ieee.org/"
},
"model": "config.society",
"pk": 7
},
{
"fields": {
"dark_image": "img/logo/cis-dark.png",
"image": "img/logo/cis-light.png",
"name": "CIS",
"url": "https://cis.ieee.org/"
},
"model": "config.society",
"pk": 8
}
]
6 changes: 4 additions & 2 deletions corpus/corpus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"pages.apps.PagesConfig",
"config.apps.ConfigConfig",
]

MIDDLEWARE = [
Expand Down Expand Up @@ -122,11 +123,12 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = "static/"
STATICFILES_DIRS = [BASE_DIR / "templates/static"]
if not DEBUG:
STATIC_URL = "static/"
STATIC_ROOT = os.path.join(BASE_DIR, "static")
else:
STATIC_URL = "/api/static/"
MEDIA_ROOT = os.path.join(BASE_DIR, "templates/static")

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
Expand Down
15 changes: 11 additions & 4 deletions corpus/pages/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
from config.models import Society
from django.shortcuts import render

# Create your views here.


def index(request):
args = {}
return render(request, "pages/index.html", args)
# Get all societies to render on landing page Societies section
societies = Society.objects.all()

return render(
request,
"pages/index.html",
{
"societies": societies,
},
)
1 change: 1 addition & 0 deletions corpus/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ asgiref==3.7.2
Django==4.2.4
gunicorn==21.2.0
packaging==23.1
Pillow==10.0.0
psycopg2==2.9.7
sqlparse==0.4.4
3 changes: 3 additions & 0 deletions corpus/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ echo "started setup"
python manage.py makemigrations
python manage.py migrate --no-input

# Import Config data
python manage.py loaddata config_db.json

# Collect static files
python manage.py collectstatic --no-input

Expand Down
Loading

0 comments on commit ef1043e

Please sign in to comment.