mirror of
https://github.com/tjsga/website-2018.git
synced 2025-04-16 01:00:17 -04:00
start templating
This commit is contained in:
parent
167b66a9ab
commit
a972d437f3
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -23,42 +23,11 @@
|
|||
</div>
|
||||
</section>
|
||||
<hr />
|
||||
{% for org in site.data.about %}
|
||||
<section id="{{ org['username'] }}">
|
||||
<h2>{{ org['name'] }}</h2>
|
||||
{% for member in org.members %}
|
||||
<div class="{{ org.username }}-intro">
|
||||
{% 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 %}
|
||||
<div class="{{ org.username }}-image">
|
||||
<img src="{{ filename | strip_newlines | downcase }}" />
|
||||
</div>
|
||||
<div class="{{ org.username }}-text">
|
||||
<span>{{ member.first }} {{ member.last }}</span>
|
||||
{% if org['username'] != "sponsors" and org['username'] != "senators" %}
|
||||
<span>{{ year }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if org['username'] != "officers" %}
|
||||
<span>{{ member.title }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if org['username'] == "officers" %}
|
||||
<p>{{ member.intro }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% for org in categories %}
|
||||
<section id="{{ org.0 }}">
|
||||
<h2>{{ org.1 }}</h2>
|
||||
{% for member in categories.org %}
|
||||
<div class="{{ org.0 }}-intro">
|
||||
</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
|
|
72
sgawebsite/templates/about.html.bk
Normal file
72
sgawebsite/templates/about.html.bk
Normal file
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
{% load static %}
|
||||
<head>
|
||||
<link href="{% static 'css/about.css' %}" rel="stylesheet" />
|
||||
{% include 'head.html' %}
|
||||
<title>About - TJSGA</title>
|
||||
</head>
|
||||
<body>
|
||||
{% include 'header.html' %}
|
||||
<div id="wrapper" class="fluid">
|
||||
<section id="contact">
|
||||
<h2>Contact Us!</h2>
|
||||
<div class="desc">
|
||||
<span class="quote">
|
||||
"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
|
||||
</span>
|
||||
</div>
|
||||
<div class="desc">
|
||||
Contact us at
|
||||
<a href="mailto:sga.tjhsst@gmail.com">sga.tjhsst@gmail.com</a>. We would love to answer questions or hear
|
||||
about how you think we can improve TJ!
|
||||
</div>
|
||||
</section>
|
||||
<hr />
|
||||
{{ categories }}
|
||||
<!--
|
||||
{% for org in categories %}
|
||||
<section id="{{ org[0] }}">
|
||||
<h2>{{ org[1] }}</h2>
|
||||
{% for member in org.members %}
|
||||
<div class="{{ org.username }}-intro">
|
||||
{% 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 %}
|
||||
<div class="{{ org.username }}-image">
|
||||
<img src="{{ filename | strip_newlines | downcase }}" />
|
||||
</div>
|
||||
<div class="{{ org.username }}-text">
|
||||
<span>{{ member.first }} {{ member.last }}</span>
|
||||
{% if org['username'] != "sponsors" and org['username'] != "senators" %}
|
||||
<span>{{ year }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if org['username'] != "officers" %}
|
||||
<span>{{ member.title }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if org['username'] == "officers" %}
|
||||
<p>{{ member.intro }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endfor %}
|
||||
-->
|
||||
</div>
|
||||
{% include 'footer.html' %}
|
||||
</body>
|
||||
</html>
|
|
@ -1,3 +1,4 @@
|
|||
{% load static %}
|
||||
<footer>
|
||||
<a href="https://facebook.com/tjsga" target="_blank">
|
||||
<button class="social" id="fb">
|
||||
|
@ -16,4 +17,4 @@
|
|||
</button>
|
||||
</a>
|
||||
</footer>
|
||||
<script src="js/sidebar-min.js"></script>
|
||||
<script src="{% static 'js/sidebar-min.js' %}"></script>
|
||||
|
|
Loading…
Reference in New Issue
Block a user