working
|
@ -39,7 +39,8 @@ INSTALLED_APPS = [
|
|||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'widget_tweaks',
|
||||
'django_cleanup'
|
||||
'django_cleanup',
|
||||
'profanity'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
@ -108,7 +109,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
TIME_ZONE = 'America/New_York'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
from django import forms
|
||||
from django.contrib.auth.models import User
|
||||
import re
|
||||
from profanity.validators import validate_is_profane
|
||||
from .models import Answer, EMOTION_CHOICES
|
||||
|
||||
class PollForm(forms.ModelForm):
|
||||
hi = forms.CharField(max_length=200, required=True)
|
||||
lo = forms.CharField(max_length=200, required=True)
|
||||
emotion = forms.ChoiceField(widget=forms.RadioSelect, choices=EMOTION_CHOICES, required=True)
|
||||
name = forms.CharField(max_length=100)
|
||||
place = forms.CharField(max_length=100)
|
||||
question = forms.CharField(max_length=200)
|
||||
hi = forms.CharField(max_length=200, validators=[validate_is_profane], required=False)
|
||||
lo = forms.CharField(max_length=200, validators=[validate_is_profane], required=False)
|
||||
emotion = forms.ChoiceField(widget=forms.RadioSelect, choices=EMOTION_CHOICES, required=False)
|
||||
name = forms.CharField(max_length=100, validators=[validate_is_profane], required=False)
|
||||
place = forms.CharField(max_length=100, validators=[validate_is_profane], required=False)
|
||||
question = forms.CharField(max_length=200, validators=[validate_is_profane], required=False)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(PollForm, self).__init__(*args, **kwargs)
|
||||
self.initial['emotion'] = 'meh'
|
||||
self.fields['emotion'] = forms.ChoiceField(widget=forms.RadioSelect, choices=EMOTION_CHOICES)
|
||||
|
||||
class Meta:
|
||||
model = Answer
|
||||
fields = ['hi', 'lo', 'emotion', 'name', 'place', 'question']
|
||||
fields = ['hi', 'lo', 'emotion', 'name', 'place','question']
|
20
homepage/migrations/0008_answer_time.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 3.1 on 2020-08-26 20:11
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('homepage', '0007_location_hero_mobile'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='answer',
|
||||
name='time',
|
||||
field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='time answered'),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
33
homepage/migrations/0009_auto_20200826_2331.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Generated by Django 3.1 on 2020-08-26 23:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('homepage', '0008_answer_time'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='location',
|
||||
name='insta',
|
||||
field=models.CharField(blank=True, max_length=20, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='location',
|
||||
name='results',
|
||||
field=models.ImageField(default='results.png', upload_to='results'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='location',
|
||||
name='results_mobile',
|
||||
field=models.ImageField(default='results-mobile.png', upload_to='results'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='answer',
|
||||
name='time',
|
||||
field=models.DateTimeField(blank=True, null=True, verbose_name='time answered'),
|
||||
),
|
||||
]
|
18
homepage/migrations/0010_answer_question_text.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.1 on 2020-08-26 23:55
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('homepage', '0009_auto_20200826_2331'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='answer',
|
||||
name='question_text',
|
||||
field=models.CharField(blank=True, max_length=50, null=True),
|
||||
),
|
||||
]
|
18
homepage/migrations/0011_auto_20200826_2014.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.1 on 2020-08-27 00:14
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('homepage', '0010_answer_question_text'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='answer',
|
||||
old_name='question_text',
|
||||
new_name='current_question',
|
||||
),
|
||||
]
|
48
homepage/migrations/0012_auto_20200826_2354.py
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Generated by Django 3.1 on 2020-08-27 03:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('homepage', '0011_auto_20200826_2014'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='answer',
|
||||
name='current_question',
|
||||
field=models.CharField(blank=True, max_length=100, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='poll',
|
||||
name='emotion_text',
|
||||
field=models.CharField(blank=True, default='how are you feeling today?', max_length=100, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='poll',
|
||||
name='hi_text',
|
||||
field=models.CharField(blank=True, default='What was the <span class="hi">Hi</span> of this we', max_length=100, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='poll',
|
||||
name='lo_text',
|
||||
field=models.CharField(blank=True, default='What was the <span class="lo">Lo</span> of this we', max_length=100, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='poll',
|
||||
name='name_text',
|
||||
field=models.CharField(blank=True, default="what's your name?", max_length=100, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='poll',
|
||||
name='place_text',
|
||||
field=models.CharField(blank=True, default='where are you from?', max_length=100, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='poll',
|
||||
name='question_text',
|
||||
field=models.CharField(blank=True, max_length=100, null=True),
|
||||
),
|
||||
]
|
|
@ -1,6 +1,9 @@
|
|||
from django.db import models
|
||||
|
||||
import os
|
||||
from django.utils import timezone
|
||||
import pytz
|
||||
|
||||
|
||||
from django.core.files import File
|
||||
|
||||
|
@ -8,6 +11,7 @@ from django.conf import settings
|
|||
from django.templatetags.static import static
|
||||
from django.utils.text import slugify
|
||||
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
# Create your models here.
|
||||
|
@ -15,33 +19,53 @@ from PIL import Image, ImageDraw, ImageFont
|
|||
class Location (models.Model):
|
||||
name = models.CharField(max_length=20, blank=True, null=True)
|
||||
slug = models.CharField(max_length=20, blank=True, null=True)
|
||||
insta = models.CharField(max_length=20, blank=True, null=True)
|
||||
|
||||
hero = models.ImageField(default="hero.png", upload_to='heros')
|
||||
hero_mobile = models.ImageField(default="hero-mobile.png", upload_to='heros')
|
||||
|
||||
results = models.ImageField(default="results.png", upload_to='results')
|
||||
results_mobile = models.ImageField(default="results-mobile.png", upload_to='results')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
def drawPic (input, output, font, x, y, text):
|
||||
img = Image.open(input)
|
||||
draw = ImageDraw.Draw(img)
|
||||
draw.text((x,y), text, (255,255,255), font=font)
|
||||
img.save(output)
|
||||
|
||||
self.slug = slugify(self.name)
|
||||
self.hero = f'heros/hero-{self.slug}.png'
|
||||
self.hero_mobile = f'heros/hero-{self.slug}-mobile.png'
|
||||
if self.insta is not None and self.insta is not '' and self.insta[0] is not '@':
|
||||
self.insta = '@' + self.insta
|
||||
|
||||
self.results = f'results/results-{self.slug}.png'
|
||||
self.results_mobile = f'results/results-{self.slug}-mobile.png'
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
output = f'{settings.PROJECT_PATH}/media/heros/hero-{self.slug}.png'
|
||||
mobile_output = f'{settings.PROJECT_PATH}/media/heros/hero-{self.slug}-mobile.png'
|
||||
|
||||
img = Image.open(settings.PROJECT_PATH + static("css/res/hero.png"))
|
||||
draw = ImageDraw.Draw(img)
|
||||
font = ImageFont.truetype(settings.PROJECT_PATH + static("css/fonts/Shorelines-Script-Bold.otf"), 80)
|
||||
draw.text((1050,450), self.slug, (255,255,255), font=font)
|
||||
img.save(output)
|
||||
|
||||
img = Image.open(settings.PROJECT_PATH + static("css/res/hero-mobile.png"))
|
||||
draw = ImageDraw.Draw(img)
|
||||
font = ImageFont.truetype(settings.PROJECT_PATH + static("css/fonts/Shorelines-Script-Bold.otf"), 80)
|
||||
draw.text((420,860), self.slug, (255,255,255), font=font)
|
||||
img.save(mobile_output)
|
||||
drawPic (settings.PROJECT_PATH + static("css/res/hero.png"), output, font, 1050, 450, self.slug)
|
||||
drawPic (settings.PROJECT_PATH + static("css/res/hero-mobile.png"), mobile_output, font, 420, 860, self.slug)
|
||||
|
||||
output = f'{settings.PROJECT_PATH}/media/results/results-{self.slug}.png'
|
||||
mobile_output = f'{settings.PROJECT_PATH}/media/results/results-{self.slug}-mobile.png'
|
||||
font = ImageFont.truetype(settings.PROJECT_PATH + static("css/fonts/FuturaPTMedium.otf"), 60)
|
||||
|
||||
if self.insta is not None and self.insta is not '':
|
||||
drawPic (settings.PROJECT_PATH + static("css/res/results.png"), output, font, 735, 805, self.insta)
|
||||
drawPic (settings.PROJECT_PATH + static("css/res/results-mobile.png"), mobile_output, font, 360, 1380, self.insta)
|
||||
else:
|
||||
img = Image.open(settings.PROJECT_PATH + static("css/res/results-noinsta.png"))
|
||||
img.save(output)
|
||||
img = Image.open(settings.PROJECT_PATH + static("css/res/results-mobile-noinsta.png"))
|
||||
img.save(mobile_output)
|
||||
|
||||
|
||||
|
||||
|
@ -49,22 +73,22 @@ class Poll (models.Model):
|
|||
location = models.OneToOneField(Location, on_delete=models.CASCADE)
|
||||
|
||||
ask_hi = models.BooleanField(default=True)
|
||||
hi_text = models.CharField(max_length=50, blank=True, null=True, default='What was the <span class="hi">Hi</span> of this we')
|
||||
hi_text = models.CharField(max_length=100, blank=True, null=True, default='What was the <span class="hi">Hi</span> of this we')
|
||||
|
||||
ask_lo = models.BooleanField(default=True)
|
||||
lo_text = models.CharField(max_length=50, blank=True, null=True, default='What was the <span class="lo">Lo</span> of this we')
|
||||
lo_text = models.CharField(max_length=100, blank=True, null=True, default='What was the <span class="lo">Lo</span> of this we')
|
||||
|
||||
ask_emotion = models.BooleanField(default=True)
|
||||
emotion_text = models.CharField(max_length=50, blank=True, null=True, default="how are you feeling today?")
|
||||
emotion_text = models.CharField(max_length=100, blank=True, null=True, default="how are you feeling today?")
|
||||
|
||||
ask_name = models.BooleanField(default=True)
|
||||
name_text = models.CharField(max_length=50, blank=True, null=True, default="what's your name?")
|
||||
name_text = models.CharField(max_length=100, blank=True, null=True, default="what's your name?")
|
||||
|
||||
ask_place = models.BooleanField(default=True)
|
||||
place_text = models.CharField(max_length=50, blank=True, null=True, default="where are you from?")
|
||||
place_text = models.CharField(max_length=100, blank=True, null=True, default="where are you from?")
|
||||
|
||||
ask_question = models.BooleanField(default=False)
|
||||
question_text = models.CharField(max_length=50, blank=True, null=True)
|
||||
question_text = models.CharField(max_length=100, blank=True, null=True)
|
||||
|
||||
pub_date = models.DateTimeField('date published')
|
||||
|
||||
|
@ -86,7 +110,32 @@ class Answer (models.Model):
|
|||
emotion = models.CharField(max_length=8, default='meh', choices=EMOTION_CHOICES, blank=True, null=True)
|
||||
name = models.CharField(max_length=100, blank=True, null=True)
|
||||
place = models.CharField(max_length=100, blank=True, null=True)
|
||||
current_question = models.CharField(max_length=100, blank=True, null=True)
|
||||
question = models.CharField(max_length=200, blank=True, null=True)
|
||||
time = models.DateTimeField('time answered', blank=True, null=True)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.time = timezone.now()
|
||||
if self.hi is '':
|
||||
self.hi = "Not stated"
|
||||
|
||||
if self.lo is '':
|
||||
self.lo = "Not stated"
|
||||
|
||||
if self.name is '':
|
||||
self.name = "Anonymous"
|
||||
|
||||
if self.place is '':
|
||||
self.place = "Somewhere"
|
||||
|
||||
if self.question is '':
|
||||
self.question = "Not stated"
|
||||
|
||||
if self.current_question is '':
|
||||
self.current_question = self.poll.question_text
|
||||
|
||||
super().save(self, *args, **kwargs)
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
return f"{self.name}'s response on {self.poll.location.name} at {self.time.strftime('%m/%d/%Y, %H:%M:%S')}"
|
1
homepage/templates/homepage/create.html
Normal file
|
@ -0,0 +1 @@
|
|||
create.html
|
|
@ -1,5 +0,0 @@
|
|||
{% extends 'homepage/base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block content %}
|
||||
{% enblock %}
|
|
@ -4,6 +4,17 @@
|
|||
|
||||
|
||||
{% block content %}
|
||||
<style type="text/css">
|
||||
.hero {
|
||||
background-image: url("{{ location.hero.url }}");
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.hero {
|
||||
background-image: url("{{ location.hero_mobile.url }}");
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<section class="jumbotron hero jumbotron-fluid m-0">
|
||||
<div class="container">
|
||||
<div class="arrow" id="arrow"></div>
|
||||
|
@ -52,8 +63,8 @@
|
|||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<section>
|
||||
<div class="jumbotron poll jumbotron-fluid m-0">
|
||||
<section class="poll-section ">
|
||||
<div class="jumbotron poll jumbotron-fluid m-0 border-0">
|
||||
<div class="container">
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
|
@ -65,31 +76,41 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<form id='poll' method="POST">
|
||||
|
||||
<form id='poll' method="POST" novalidate>
|
||||
{% csrf_token %}
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{ hidden }}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{{ form.errors }}
|
||||
{{ form.non_field_errors }}
|
||||
|
||||
<div class="row title pb-3 ">
|
||||
<p for="test" class="mx-auto subtitle">NOW IS YOUR TIME TO SHINE</p>
|
||||
<p for="test" class="mx-auto title">NOW IS YOUR TIME TO SHINE</p>
|
||||
</div>
|
||||
{% if hi_text %}
|
||||
<div class="row pb-3 short-answer">
|
||||
<label class="mx-auto" for="{{ form.hi.id_for_label }}">{{ hi_text|safe }}</label>
|
||||
{{ form.hi|add_class:'w-75 mx-auto rounded' }}
|
||||
{{ form.hi|add_class:'w-80 mx-auto rounded' }}
|
||||
{% for error in form.hi.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{{ form.hi|add_class:'hidden' }}
|
||||
{% endif %}
|
||||
{% if lo_text %}
|
||||
<div class="row pb-3 short-answer">
|
||||
<label class="mx-auto" for="{{ form.lo.id_for_label }}">What was the <span class="lo">Lo</span> of this week?</label>
|
||||
{{ form.lo|add_class:'w-75 mx-auto rounded' }}
|
||||
{{ form.lo|add_class:'w-80 mx-auto rounded' }}
|
||||
{% for error in form.lo.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{{ form.lo|add_class:'hidden' }}
|
||||
{% endif %}
|
||||
<div class="row pb-1 subtitle">
|
||||
<p class="mx-auto">SOME MORE QUESTIONS FOR THE SOUL</p>
|
||||
|
@ -109,33 +130,43 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% for radio in form.emotion %}
|
||||
{{ radio.tag|add_class:'hidden' }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if name_text %}
|
||||
<div class="row pb-3 short-answer">
|
||||
<label class="mx-auto" for="{{ form.name.id_for_label }}">{{ name_text|safe }}</label>
|
||||
{{ form.name|add_class:'w-75 mx-auto rounded' }}
|
||||
{{ form.name|add_class:'w-80 mx-auto rounded' }}
|
||||
{% for error in form.name.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{{ form.name|add_class:'hidden' }}
|
||||
{% endif %}
|
||||
{% if place_text %}
|
||||
<div class="row pb-3 short-answer">
|
||||
<label class="mx-auto" for="{{ form.place.id_for_label }}">{{ place_text|safe }}</label>
|
||||
{{ form.place|add_class:'w-75 mx-auto rounded' }}
|
||||
{{ form.place|add_class:'w-80 mx-auto rounded' }}
|
||||
{% for error in form.place.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{{ form.place|add_class:'hidden' }}
|
||||
{% endif %}
|
||||
{% if question_text %}
|
||||
<div class="row pb-3 short-answer">
|
||||
<label class="mx-auto" for="{{ form.question.id_for_label }}">{{ question_text|safe }}</label>
|
||||
{{ form.question|add_class:'w-75 mx-auto rounded' }}
|
||||
{{ form.question|add_class:'w-80 mx-auto rounded' }}
|
||||
{% for error in form.question.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{{ form.question|add_class:'hidden' }}
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<button type="submit" class="mx-auto btn text-uppercase">
|
||||
|
|
48
homepage/templates/homepage/results.html
Normal file
|
@ -0,0 +1,48 @@
|
|||
{% extends 'homepage/base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block content %}
|
||||
<style type="text/css">
|
||||
body {
|
||||
background-color: #353a40;
|
||||
}
|
||||
|
||||
.hero {
|
||||
background-image: url("{{ location.results.url }}");
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.hero {
|
||||
background-image: url("{{ location.results_mobile.url }}");
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<section class="jumbotron hero jumbotron-fluid m-0"></section>
|
||||
{% for answer in answers %}
|
||||
<div class="card text-white bg-dark mb-3">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
{% if forloop.first %}
|
||||
<div class="card-header">
|
||||
Hey it's you!
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{{answer.name}} from {{answer.place}} <small>at {{answer.time}}</small></h5>
|
||||
<p class="card-text"><b>High of their week:</b> {{answer.hi}}</p>
|
||||
<p class="card-text"><b>Low of their week:</b> {{answer.lo}}</p>
|
||||
{% if poll.ask_question %}
|
||||
<p class="card-text"><b>{{ answer.current_question }}</b>: {{answer.question}}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title mb-2">They were feeling:</h5>
|
||||
<img class="results-emote" src="{% static 'css/res/'|add:answer.emotion|add:'.svg' %}" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
|
@ -4,5 +4,5 @@ from . import views
|
|||
urlpatterns = [
|
||||
path ('', views.homepage, name="homepage"),
|
||||
path ('<slug:slug>/', views.homepage),
|
||||
path ('finish/', views.finish, name="finish")
|
||||
path ('<slug:slug>/results/', views.results)
|
||||
]
|
||||
|
|
|
@ -2,9 +2,8 @@ from django.shortcuts import render, redirect
|
|||
from django.contrib import messages
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.http import HttpResponseNotFound
|
||||
|
||||
from .forms import PollForm
|
||||
from .models import Poll, Location
|
||||
from .models import Poll, Location, Answer
|
||||
|
||||
# Create your views here.
|
||||
|
||||
|
@ -54,8 +53,7 @@ def homepage (request, slug="arlington"):
|
|||
instance = form.save(commit=False)
|
||||
instance.poll = poll
|
||||
instance.save()
|
||||
print(instance.pk)
|
||||
return redirect('finish')
|
||||
return redirect(f'/{location.slug}/results')
|
||||
else:
|
||||
messages.error(request, 'Looks like there were some problems with your form!', extra_tags='danger')
|
||||
print("invalid form!")
|
||||
|
@ -64,6 +62,8 @@ def homepage (request, slug="arlington"):
|
|||
|
||||
context = {
|
||||
'form': form,
|
||||
'poll': poll,
|
||||
'location': location,
|
||||
'hi_text': hi_text,
|
||||
'lo_text': lo_text,
|
||||
'emotion_text': emotion_text,
|
||||
|
@ -74,6 +74,20 @@ def homepage (request, slug="arlington"):
|
|||
|
||||
return render(request, 'homepage/index.html', context=context)
|
||||
|
||||
def finish (request):
|
||||
pass
|
||||
def results (request, slug="arlington"):
|
||||
location = get_object_or_404(Location, slug=slug)
|
||||
|
||||
try:
|
||||
poll = location.poll
|
||||
except:
|
||||
return HttpResponseNotFound(f'404: No poll was found for {location}!')
|
||||
|
||||
answers = Answer.objects.filter(poll=poll)
|
||||
|
||||
context = {
|
||||
'location':location,
|
||||
'poll':poll,
|
||||
'answers':answers,
|
||||
}
|
||||
|
||||
return render(request, 'homepage/results.html', context=context)
|
BIN
static/css/res/FuturaPTMedium.otf
Normal file
BIN
static/css/res/banner-wys.png
Normal file
After Width: | Height: | Size: 698 KiB |
Before Width: | Height: | Size: 698 KiB After Width: | Height: | Size: 225 KiB |
BIN
static/css/res/hilo-hero.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
static/css/res/poll-mobile.png
Normal file
After Width: | Height: | Size: 165 KiB |
BIN
static/css/res/poll.png
Normal file
After Width: | Height: | Size: 97 KiB |
BIN
static/css/res/results-mobile-noinsta.png
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
static/css/res/results-mobile.png
Normal file
After Width: | Height: | Size: 100 KiB |
BIN
static/css/res/results-noinsta.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
static/css/res/results.png
Normal file
After Width: | Height: | Size: 65 KiB |
|
@ -17,9 +17,9 @@
|
|||
src: url("./fonts/FuturaPTHeavy.otf");
|
||||
font-family: "Futura-Heavy"; }
|
||||
html {
|
||||
background-color: #333;
|
||||
font-family: "Hanson-Bold", "Arial", sans-serif;
|
||||
overflow-x: none; }
|
||||
background-color: #222;
|
||||
font-family: "Futura-Heavy", "Arial", sans-serif;
|
||||
overflow-x: none !important; }
|
||||
|
||||
body {
|
||||
overflow-y: scroll;
|
||||
|
@ -33,8 +33,6 @@ body::-webkit-scrollbar {
|
|||
display: none; }
|
||||
|
||||
.hero {
|
||||
color: #333 !important;
|
||||
background-color: #333 !important;
|
||||
background-image: url("res/hilo-hero-text.png");
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
|
@ -87,26 +85,24 @@ body::-webkit-scrollbar {
|
|||
background-color: #fff; }
|
||||
|
||||
.info-header {
|
||||
color: white;
|
||||
font-family: "Hanson-Bold", "Arial", sans-serif;
|
||||
text-stroke: 3px #305899;
|
||||
-webkit-text-stroke: 3px #305899; }
|
||||
color: #2b5291;
|
||||
font-family: "Futura-Heavy", "Arial", sans-serif; }
|
||||
@media (max-width: 768px) {
|
||||
.info-header {
|
||||
font-size: 1.25em;
|
||||
text-stroke: 2px #305899;
|
||||
-webkit-text-stroke: 2px #305899; } }
|
||||
font-size: 1.25em; } }
|
||||
|
||||
.info {
|
||||
font-size: .8em;
|
||||
color: #2b5291;
|
||||
font-family: "Hanson-Bold", "Arial", sans-serif; }
|
||||
font-family: "Futura-Heavy", "Arial", sans-serif; }
|
||||
@media (max-width: 768px) {
|
||||
.info {
|
||||
font-size: .75em; } }
|
||||
|
||||
#insta-section {
|
||||
background-color: #333; }
|
||||
border-bottom: 2px solid white; }
|
||||
#insta-section div {
|
||||
background-color: pink; }
|
||||
|
||||
.bg-colored:before {
|
||||
right: -999em;
|
||||
|
@ -118,49 +114,50 @@ body::-webkit-scrollbar {
|
|||
top: 0;
|
||||
bottom: 0; }
|
||||
|
||||
.poll-section {
|
||||
text-align: center; }
|
||||
|
||||
.poll {
|
||||
color: white;
|
||||
background-image: url("res/gradient-mobile.png");
|
||||
background-color: #222;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-attachment: fixed;
|
||||
font-family: "Hanson-Bold", "Arial", sans-serif;
|
||||
font-family: "Futura-Heavy", "Arial", sans-serif;
|
||||
font-weight: lighter;
|
||||
font-size: .75em; }
|
||||
@media (max-width: 768px) {
|
||||
.poll {
|
||||
background-image: url("res/gradient-mobile.png"); } }
|
||||
|
||||
.short-answer {
|
||||
font-size: 1.2em; }
|
||||
font-size: 1.1em; }
|
||||
|
||||
.title {
|
||||
color: #42b8c7;
|
||||
font-size: 1.45em; }
|
||||
font-size: 1.20em;
|
||||
text-align: center; }
|
||||
@media (min-width: 768px) {
|
||||
.title {
|
||||
font-size: 1.45em; } }
|
||||
|
||||
.subtitle {
|
||||
color: #42b8c7;
|
||||
font-size: 1.15em; }
|
||||
font-size: 1.1em; }
|
||||
@media (min-width: 768px) {
|
||||
.subtitle {
|
||||
font-size: 1.2em; } }
|
||||
|
||||
label {
|
||||
font-size: 1.25em; }
|
||||
|
||||
.emote img {
|
||||
width: 25vw;
|
||||
height: auto; }
|
||||
|
||||
.btn {
|
||||
color: #2b5291;
|
||||
border-image-repeat: none; }
|
||||
|
||||
.hi {
|
||||
color: #48B93E;
|
||||
font-family: "WildYouth", "Hanson-Bold", "Arial", sans-serif; }
|
||||
color: #48B93E; }
|
||||
|
||||
.lo {
|
||||
color: #E34848;
|
||||
font-family: "WildYouth", "Hanson-Bold", "Arial", sans-serif; }
|
||||
color: #E34848; }
|
||||
|
||||
[type=radio] {
|
||||
position: absolute;
|
||||
|
@ -170,10 +167,28 @@ label {
|
|||
|
||||
/* IMAGE STYLES */
|
||||
[type=radio] + img {
|
||||
cursor: pointer; }
|
||||
cursor: pointer;
|
||||
width: 25vw;
|
||||
height: auto; }
|
||||
@media (min-width: 768px) {
|
||||
[type=radio] + img {
|
||||
width: 10vw;
|
||||
height: auto;
|
||||
margin: auto;
|
||||
display: block; } }
|
||||
|
||||
/* CHECKED STYLES */
|
||||
[type=radio]:checked + img {
|
||||
outline: 2px solid #2b5291; }
|
||||
|
||||
.hidden {
|
||||
display: none; }
|
||||
|
||||
.w-80 {
|
||||
width: 80%; }
|
||||
|
||||
.results-emote {
|
||||
width: 150px;
|
||||
height: auto; }
|
||||
|
||||
/*# sourceMappingURL=styles.css.map */
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
}
|
||||
|
||||
// fonts
|
||||
$font-stack: 'Hanson-Bold','Arial',sans-serif;
|
||||
$font-stack: 'Futura-Heavy','Arial',sans-serif;
|
||||
|
||||
@font-face {
|
||||
src: url("./fonts/Hanson-Bold.ttf");
|
||||
|
@ -56,6 +56,7 @@ $mobile-width: 768px;
|
|||
|
||||
// colors
|
||||
$dark-grey: #333;
|
||||
$darker-grey: #222;
|
||||
$text: #2b5291;
|
||||
$text-light: #42b8c7;
|
||||
$header-stroke: #305899;
|
||||
|
@ -64,10 +65,10 @@ $green: #48B93E;
|
|||
$red: #E34848;
|
||||
|
||||
html {
|
||||
background-color: $dark-grey;
|
||||
background-color: $darker-grey;
|
||||
font-family: $font-stack;
|
||||
|
||||
overflow-x: none;
|
||||
overflow-x: none!important;
|
||||
}
|
||||
|
||||
body {
|
||||
|
@ -81,8 +82,6 @@ body::-webkit-scrollbar {
|
|||
}
|
||||
|
||||
.hero {
|
||||
color: $dark-grey !important;
|
||||
background-color: $dark-grey !important;
|
||||
background-image: url("res/hilo-hero-text.png");
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
|
@ -157,15 +156,15 @@ body::-webkit-scrollbar {
|
|||
}
|
||||
|
||||
.info-header {
|
||||
color: white;
|
||||
color: $text;
|
||||
font-family: $font-stack;
|
||||
text-stroke: 3px $header-stroke;
|
||||
-webkit-text-stroke: 3px $header-stroke;
|
||||
//text-stroke: 3px $header-stroke;
|
||||
//-webkit-text-stroke: 3px $header-stroke;
|
||||
|
||||
@include mobile {
|
||||
font-size: 1.25em;
|
||||
text-stroke: 2px $header-stroke;
|
||||
-webkit-text-stroke: 2px $header-stroke;
|
||||
//text-stroke: 2px $header-stroke;
|
||||
//-webkit-text-stroke: 2px $header-stroke;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,7 +179,10 @@ body::-webkit-scrollbar {
|
|||
}
|
||||
|
||||
#insta-section {
|
||||
background-color: $dark-grey;
|
||||
border-bottom: 2px solid white;
|
||||
div {
|
||||
background-color: pink;
|
||||
}
|
||||
}
|
||||
|
||||
.bg-colored:before {
|
||||
|
@ -194,9 +196,14 @@ body::-webkit-scrollbar {
|
|||
bottom: 0;
|
||||
}
|
||||
|
||||
.poll-section {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.poll {
|
||||
color: white;
|
||||
background-image: url("res/gradient-mobile.png");
|
||||
//background-image: url("res/poll-gradient.png");
|
||||
background-color: $darker-grey;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
|
@ -205,33 +212,35 @@ body::-webkit-scrollbar {
|
|||
font-weight: lighter;
|
||||
font-size: .75em;
|
||||
@include mobile {
|
||||
background-image: url("res/gradient-mobile.png");
|
||||
//background-image: url("res/gradient-mobile.png");
|
||||
};
|
||||
}
|
||||
|
||||
.short-answer {
|
||||
font-size: 1.2em;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.title {
|
||||
color: $text-light;
|
||||
font-size: 1.45em;
|
||||
font-size: 1.20em;
|
||||
text-align: center;
|
||||
@include desktop {
|
||||
font-size: 1.45em;
|
||||
}
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: $text-light;
|
||||
font-size: 1.15em;
|
||||
font-size: 1.1em;
|
||||
@include desktop {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
.emote img {
|
||||
width: 25vw;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: $text;
|
||||
border-image-repeat: none;
|
||||
|
@ -239,12 +248,10 @@ label {
|
|||
|
||||
.hi {
|
||||
color: $green;
|
||||
font-family: "WildYouth", $font-stack;
|
||||
}
|
||||
|
||||
.lo {
|
||||
color: $red;
|
||||
font-family: "WildYouth", $font-stack;
|
||||
}
|
||||
|
||||
[type=radio] {
|
||||
|
@ -257,9 +264,30 @@ label {
|
|||
/* IMAGE STYLES */
|
||||
[type=radio] + img {
|
||||
cursor: pointer;
|
||||
width: 25vw;
|
||||
height: auto;
|
||||
@include desktop {
|
||||
width: 10vw;
|
||||
height: auto;
|
||||
margin: auto;
|
||||
display: block;
|
||||
};
|
||||
}
|
||||
|
||||
/* CHECKED STYLES */
|
||||
[type=radio]:checked + img {
|
||||
outline: 2px solid $text;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.w-80 {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.results-emote {
|
||||
width: 150px;
|
||||
height: auto;
|
||||
}
|