diff --git a/sgawebsite/apps/main/models.py b/sgawebsite/apps/main/models.py index 71a8362..8fbb1df 100644 --- a/sgawebsite/apps/main/models.py +++ b/sgawebsite/apps/main/models.py @@ -1,3 +1,18 @@ from django.db import models # Create your models here. +class Member(models.Model): + first_name = models.CharField(max_length=50) + last_name = models.CharField(max_length=50) + year = models.IntegerField() + intro = models.CharField(max_length=140) + title = models.CharField(max_length=30) + CATEGORIES = (('officers', 'Officers'), ('excomm', 'Executive Committee'), ('senators', 'Class Senators'), ('sponsors', 'Sponsors')) + category = models.CharField(max_length=1, choices=CATEGORIES) + +class Resource(models.Model): + name = models.CharField(max_length=50) + link = models.URLField() + text = models.CharField(max_length=140) + CATEGORIES = (('general', 'General Resources'), ('event', 'Event Resources')) + category = models.CharField(max_length=1, choices=CATEGORIES) diff --git a/sgawebsite/apps/main/views.py b/sgawebsite/apps/main/views.py index 664f7ee..f9d642f 100644 --- a/sgawebsite/apps/main/views.py +++ b/sgawebsite/apps/main/views.py @@ -1,13 +1,22 @@ from django.shortcuts import render +from .models import Member, Resource def index(request): - return render(request, "index.html") + return render(request, 'index.html') def about(request): - return render(request, "about.html") + categories = Member.CATEGORIES + context = dict() + data = dict() + for c in categories: + data[c[0]] = Member.objects.filter(category=c[0]) + context['categories'] = categories + context['data'] = data + print(context) + return render(request, 'about.html', context) def resources(request): - return render(request, "resources.html") + return render(request, 'resources.html') def events(request): - return render(request, "events.html") + return render(request, 'events.html') diff --git a/sgawebsite/templates/about.html b/sgawebsite/templates/about.html index 742cf25..d4e075f 100644 --- a/sgawebsite/templates/about.html +++ b/sgawebsite/templates/about.html @@ -23,42 +23,11 @@
- {% for org in site.data.about %} -
-

{{ org['name'] }}

- {% for member in org.members %} -
- {% assign year = member.year | downcase %} - {% assign first = member.first | slice: 0 %} - {% assign last = member.last | slice: 0,7 %} - {% if org['username'] != "sponsors" %} - {% capture filename %}img/people/{{ year }}{{ first }}{{ last }}.jpg{% endcapture %} - {% else %} - {% capture filename %}img/people/{{ first }}{{ last }}.jpg{% endcapture %} - {% endif %} - {% capture exists %} - {% file_exists {{ path }} %} - {% endcapture %} - {% if exists == false %} - {% capture filename %}img/profile.jpg{% endcapture %} - {% endif %} -
- -
-
- {{ member.first }} {{ member.last }} - {% if org['username'] != "sponsors" and org['username'] != "senators" %} - {{ year }} - {% endif %} - - {% if org['username'] != "officers" %} - {{ member.title }} - {% endif %} - - {% if org['username'] == "officers" %} -

{{ member.intro }}

- {% endif %} -
+ {% for org in categories %} +
+

{{ org.1 }}

+ {% for member in categories.org %} +
{% endfor %}
diff --git a/sgawebsite/templates/about.html.bk b/sgawebsite/templates/about.html.bk new file mode 100644 index 0000000..bb371af --- /dev/null +++ b/sgawebsite/templates/about.html.bk @@ -0,0 +1,72 @@ + + +{% load static %} + + + {% include 'head.html' %} + About - TJSGA + + + {% include 'header.html' %} +
+
+

Contact Us!

+
+ + "The world is moved not only by the mighty shoves of the heroes, but also by the aggregate of the tiny pushes of each honest worker." - Helen Keller + +
+
+ Contact us at + sga.tjhsst@gmail.com. We would love to answer questions or hear + about how you think we can improve TJ! +
+
+
+ {{ categories }} + +
+ {% include 'footer.html' %} + + diff --git a/sgawebsite/templates/footer.html b/sgawebsite/templates/footer.html index e99d1f4..7c2e910 100644 --- a/sgawebsite/templates/footer.html +++ b/sgawebsite/templates/footer.html @@ -1,3 +1,4 @@ +{% load static %} - +